复制代码代码如下 :
<script type = "text/javaScript">
함수 getTxt1cursorPosition () {
var otxt1 = document.getElementById ( "txt1");
var cursurosposition = -1;
if (otxt1.selectionStart) {// 非 非 ie 浏览器
cursurposition = otxt1.selectionStart;
} else {// 즉
var 범위 = document.selection.createrange ();
range.movestart ( "문자",-otxt1.value.length);
cursurposition = range.text.length;
}
경고 (cursurosposition);
}
함수 settxt1cursorPosition (i) {
var otxt1 = document.getElementById ( "txt2");
var cursurosposition = -1;
if (otxt1.selectionStart) {// 非 非 ie 浏览器
otxt1.selectionStart = i;
} else {// 즉
var range = otxt1.creatextrange ();
Range.move ( "문자", i);
Range.Select ();
}
}
함수 getta1cursorPosition () {
var evt = window.event? wind
var ota1 = document.getElementById ( "ta1");
var cursurosposition = -1;
if (ota1.selectionStart) {// 非 非 ie 浏览器
cursurposition = ota1.selectionStart;
} else {// 즉
var range = ota1.creatextrange ();
range.movetopoint (Evt.x, evt.y);
range.movestart ( "문자",-ota1.value.length);
cursurposition = range.text.length;
}
경고 (cursurosposition);
}
함수 setta1cursorPosition (i) {
var ota2 = document.getElementById ( "ta2");
if (ota2.selectionStart) {// 非 非 ie 浏览器
ota2.selectionStart = i;
ota2.selectionend = i;
} else {// 즉
var range = ota2.creatextrange ();
Range.move ( "문자", i);
Range.Select ();
}
}
</스크립트>