<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<input type="text" style="width:700px" id="test1" name="test1" value="test12设置鼠标的停留的地方设置鼠标的停留的地方设置鼠标的停留的地方设置鼠标的停留的地方设置鼠标的停留的地方设置鼠标的停留的地方3"
onclick="getthis(this);" />
<script>
function getthis(obj) //获取鼠标停留的位置
{
var i = obj.selectionStart;
var t = obj.selectionEnd;
}
function moveEnd(obj) {
obj.focus();
if (typeof obj.selectionStart == 'number'
&& typeof obj.selectionEnd == 'number') {
obj.selectionStart = obj.selectionEnd = 1; //设置鼠标的停留的地方
}
}
moveEnd(document.getElementById("test1"))
</script>
</body>
</html>