JavaScript使光标定位到文本的最后
function setEnd(field) {
if (field.createTextRange) {
var r = field.createTextRange();
r.moveStart('character', field.value.length);
r.collapse();
r.select();
}
}
<INPUT TYPE="text" name="userName" value="测试" onfocus="setEnd(this)">
<INPUT TYPE="text" name="userAge" value="测试" onfocus="setEnd(this)">
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
问:
1.如何在JavaScript访问C#函数?
2.如何在JavaScript访问C#变量?
3.如何在C#中访问JavaScript的已有变量?
4.如何在C#中访问JavaScript函数?
问题1答案如下:
javaScript函数中执行C#代码中的函数:
方法一:1、首先建立一个按钮,在后台将调用或处理的内容写入button_click中;
2、在前台写一个js函数,内容为 ......
打开一个 js 文件,编辑完成保存时,突然提醒下面的错误:
Save could not be completed.
Reason:
Some characters cannot be mapped using “ISO-8859-1″ character encoding. Either change the encoding or remove the characters which are not supported by the “ISO-8859-1″ character ......