这些基本是Dhtml的东西,下载个INet.chm,里面会有详细的例子
解决方案 »
- extjs中treepanel无法展开
- 抓狂的 jquery .children方法
- 关于asp.net导出excel
- 怎么用JS实现把图像导出到excel?
- javascript中‘$’的问题
- 请教个js代码
- 为什么我用showModalDialog打开的窗口返回的值却是NULL??
- 父窗口打开子窗口 能不能在父窗口取到子窗口的handle
- 在页面中通过<object></object>加载一个控件会提示是否安装,如何知道用户是否回答“是”?
- 这个功能怎么实现?
- 如何用Javascript来判断SQL的varchar类型为NULL????
- 怎么得到一个没有指定 style.width 的 Div 的宽度?
getBoundingClientRect()//该元素的矩形集合
getClientRects()//各行的矩形集合<HEAD>
<SCRIPT>
var rcts;
var keyCount=0;function Highlight(obj) {
rcts = obj.getClientRects();//返回一个集合,元素为各行的矩形
rctLength= rcts.length;//即得到有多少行
if (keyCount > rctLength-1) {//判断是否过了长度
idBeige.style.display="none";//如果是,隐藏idBeige
keyCount = 0//下次从头开始
}
// set the rendering properties for the yellow DIV
cdRight = rcts[keyCount].right + idBody.scrollLeft;//当前矩形的右边位置(相对于Body)加上Body的scrollLeft=实际的右边位置
cdLeft = rcts[keyCount].left + idBody.scrollLeft;//同上
cdTop = rcts[keyCount].top + idBody.scrollTop;//同上
cdBottom = rcts[keyCount].bottom + idBody.scrollTop;//同上
idYellow.style.top = cdTop;//设置top
idYellow.style.width = (cdRight-cdLeft) - 5;//设置width
idYellow.style.display = 'inline';//显示 // set the rendering properties for the beige DIV
bndRight = obj.getBoundingClientRect().right +
idBody.scrollLeft;//beige条的右边实际位置
bndLeft = obj.getBoundingClientRect().left +
idBody.scrollLeft;//beige条的左边实际位置
bndTop = obj.getBoundingClientRect().top +
idBody.scrollTop;//beige条的顶边实际位置
idBeige.style.top = bndTop;//设置beige条top
idBeige.style.width = (bndRight-bndLeft) - 5;//设置beige条Width
idBeige.style.height = cdTop - bndTop;//两者差为“阅读过”的痕迹
if (keyCount>0){
idBeige.style.display = 'inline';//如果大于0,显示
}
keyCount++;//
}
</SCRIPT>
</HEAD><BODY ID="idBody">
<DIV ID="oID_1" onclick="Highlight(this)"
onkeydown="Highlight(this)">
A large block of text should go here. Click on this
block of text multiple times to see each line
highlight with every click of the mouse button.
Once each line has been highlighted, the process
will begin again starting with the first line.
</DIV>
<DIV STYLE="position:absolute; left:5; top:400;z-index:-1; background-color:yellow; display:none"
ID="idYellow"></DIV>
<DIV STYLE="position:absolute; left:5; top:400;z-index:-1; background-color:beige; display:none"
ID="idBeige"></DIV>
</BODY>
谢谢,