问个很弱的问题 模拟 鼠标下文本的最后一个字符。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 L@_@K<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> new document </title> <meta name="generator" content="editplus" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> </head> <body> <input type="text" id="txtInput" value="input something" /> <script type="text/javascript"> <!--function $(sId){ return document.getElementById(sId);}function setCaretById(sId, iPos){ var oTextBox = document.getElementById(sId); setCaret(oTextBox, iPos);}function setCaret(oTextBox, iPos){ var r = oTextBox.createTextRange(); r.collapse(true); r.moveStart('character', iPos); r.select();}$("txtInput").onblur = function() { setCaret(this, this.value.length);}; //--> </script> </body></html> 关于ajaxupload.3.6.JS使用异常 body中把div隐藏起来的问题,在线等 [求助]控制iframe载入的方法的优化 弱类型语言的郁闷--Javascript in ASP,大家一起来看看。 JavaScript实现 :点击按钮div里面的左右移动 如何让脚本自动执行一个文件 XMLHttpRequest的问题! htc里的文本框不能正常处理剪切粘贴等事件 我想把一张图片放在另一张图片的上面,可以实现吗,能否给个例子 请问关于VML线条粗细问题? 求段JS代码~关于文本域的简单问题!~在线等~ 能用js得到特定class下的所有input框吗?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head> <body>
<input type="text" id="txtInput" value="input something" />
<script type="text/javascript">
<!--
function $(sId)
{
return document.getElementById(sId);
}function setCaretById(sId, iPos)
{
var oTextBox = document.getElementById(sId);
setCaret(oTextBox, iPos);
}
function setCaret(oTextBox, iPos)
{
var r = oTextBox.createTextRange();
r.collapse(true);
r.moveStart('character', iPos);
r.select();
}
$("txtInput").onblur = function() {
setCaret(this, this.value.length);
};
//-->
</script>
</body>
</html>