<table border>
<tr><td onclick="a(this)">aaaa</td></tr>
<tr><td onclick="a(this)">bbbb</td></tr>
</table>
<script>
function a(o)
{
txt=window.document.body.createTextRange()
if(txt.findText(o.innerText))
{
txt.moveStart("character",0);
txt.scrollIntoView();
txt.select();
}
}
</script>
<tr><td onclick="a(this)">aaaa</td></tr>
<tr><td onclick="a(this)">bbbb</td></tr>
</table>
<script>
function a(o)
{
txt=window.document.body.createTextRange()
if(txt.findText(o.innerText))
{
txt.moveStart("character",0);
txt.scrollIntoView();
txt.select();
}
}
</script>
解决方案 »
- extjs静态的创建树形,然后把整颗树提交到后台
- js访问修改css属性不能兼容chrome
- EXTJS Viewport滚动条
- 哪位大侠对这些位置定位搞得很清楚,请帮我一一详细解释下哈!
- 如何使onmouseonver方法延迟执行?
- sohu的新邮箱界面的阅读邮件的浮动页面(或层)是怎么实现的
- 弹出新窗口问题???????在线等待
- 请问如何在javascript中将字符型转化为整数型,用什么函数?
- list框的动态删除被选择项,以及动态去选择的代码该怎莫写?
- QQ相册 这种点击照片放大怎么做的
- 请问如何用JAVASCRIPT实现在网页上动态加载控件(在线等待)
- 怎样不刷新页面,即时获得可以走动服务器时间,也就是在页面上加一个服务器端的时钟
INPUT type=button
INPUT type=checkbox
INPUT type=file
INPUT type=image
INPUT type=password
INPUT type=radio
INPUT type=reset
INPUT type=submit
INPUT type=text
TEXTAREA
TextRange controlRange
Sample:function TextRangeSelect() {
var r = document.body.createTextRange();
r.findText("text here");
r.select();
}
我的表是放在DIV上面,请问DIV是否支持createTextRange()方法?
<table border>
<tr><td onclick="a(this)">aaaa</td></tr>
<tr><td onclick="a(this)">bbbb</td></tr>
<tr><td onclick="a(this)">aaaa</td></tr>
</table>
<script>
function a(o)
{
txt=window.document.body.createTextRange()
if(txt.findText(o.innerText))
{
txt.moveStart("character",0);
txt.scrollIntoView();
txt.select();
}
}
</script>