<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<textarea id="o"></textarea>
<input type="button" value="aaaa" οnclick="setSelectText(document.getElementById('o'),0,300)" />
<script>
function setSelectText(el,start,end){
if(el.createTextRange){
var Range=el.createTextRange();
Range.collapse();
Range.moveEnd('character',end);
Range.moveStart('character',start);
Range.select();
}
if(el.setSelectionRange){
el.focus();
el.setSelectionRange(start,end); //设光标
}
}
</script>
</body>
</html>
-------------------------------------------------------------------------------------------------------------------------------------
//全选/取消
function if_select_all()
{
var check_boxes = document.getElementsByName("bindappid");
for(var i= 0;i<check_boxes.length;i++)
{
if(check_boxes[i].type == "checkbox")
check_boxes[i].checked = document.getElementById("bindappidall").checked;
}
}
</script>
<tr>
<td width="100%" nowrap><input name="bindappid001" id="bindappidall" οnclick="if_select_all()" type="checkbox">全选/取消</td>
</tr>
光标全选择 js
最新推荐文章于 2024-04-24 15:42:33 发布