//定位到行
function goto(tln)
{
if (!/^\d+$/.test(tln) || tln == 0)
{
return;
}
var obj = document.getElementById("scriptingContent");
var rng = obj.createTextRange();
var arr = obj.value.split(/\n/);
if (tln > arr.length)
{
tln = arr.length;
}
var str_tmp = "";
for (var i = 0; i < tln - 1; i++)
{
str_tmp += arr[i];
}
rng.moveStart("character", str_tmp.length);
str_tmp = "";
for (i = tln; i < arr.length; i++)
{
str_tmp += arr[i];
}
rng.moveEnd("character", -str_tmp.length);
rng.select();
return;
}
http://www.ibm.com/developerworks/cn/websphere/library/techarticles/chenjunwei/wdoapp.html
function goto(tln)
{
if (!/^\d+$/.test(tln) || tln == 0)
{
return;
}
var obj = document.getElementById("scriptingContent");
var rng = obj.createTextRange();
var arr = obj.value.split(/\n/);
if (tln > arr.length)
{
tln = arr.length;
}
var str_tmp = "";
for (var i = 0; i < tln - 1; i++)
{
str_tmp += arr[i];
}
rng.moveStart("character", str_tmp.length);
str_tmp = "";
for (i = tln; i < arr.length; i++)
{
str_tmp += arr[i];
}
rng.moveEnd("character", -str_tmp.length);
rng.select();
return;
}
http://www.ibm.com/developerworks/cn/websphere/library/techarticles/chenjunwei/wdoapp.html