鼠标前置
程序员文章站
2022-05-30 22:22:22
...
<html>
<head>
<script src="jquery-1.4.2.min.js"></script>
<script>
function toFront(){
var obj = document.getElementById("myinput");
//IE
if($.browser.msie){
var range = obj.createTextRange();
range.moveStart("character", 0);
//range.moveEnd("character", 0);
range.collapse(true);
range.select();
}
//非IE
else{
obj.setSelectionRange(0, 0);
obj.focus();
}
}
</script>
</head>
<body>
<br/><br/>
<input id="myinput" type="text"/><input type="button" value="FRONT" onclick="toFront()"/>
</body>
</html>
<head>
<script src="jquery-1.4.2.min.js"></script>
<script>
function toFront(){
var obj = document.getElementById("myinput");
//IE
if($.browser.msie){
var range = obj.createTextRange();
range.moveStart("character", 0);
//range.moveEnd("character", 0);
range.collapse(true);
range.select();
}
//非IE
else{
obj.setSelectionRange(0, 0);
obj.focus();
}
}
</script>
</head>
<body>
<br/><br/>
<input id="myinput" type="text"/><input type="button" value="FRONT" onclick="toFront()"/>
</body>
</html>
上一篇: Flutter第一部分(UI)第三篇:简单几步带你构建一个漂亮的UI实例
下一篇: 如何安装禅道