把选择的范围向后移动两个单词,然后在选择起来,为什么没有效果呢???
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<SCRIPT LANGUAGE="JScript">
function init()
{
var rng = document.selection.createRange();rng.move("word",2);
rng.select();}
</SCRIPT>
</head><BODY onclick="init()">
<div id=my1 style="border:1px solid red;padding:20px">
this is my program this is my program this is my program this is my program
</div>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<SCRIPT LANGUAGE="JScript">
function init()
{
var rng = document.selection.createRange();rng.move("word",2);
rng.select();}
</SCRIPT>
</head><BODY onclick="init()">
<div id=my1 style="border:1px solid red;padding:20px">
this is my program this is my program this is my program this is my program
</div>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货