缩放页面

<script language="javascript">
var i=0;
document.onkeydown = zoom;
function zoom(){
var IEKey = event.keyCode;
if (IEKey == 76) {
i++;
document.body.style.zoom=1+i/10;
}
if (IEKey == 83) {
i--;
document.body.style.zoom=1+i/10;
}
if (IEKey == 82) {
document.body.style.zoom=1;
i=1;
}
}
</script>
S:缩小 L:放大 R:还原

--------------------
返回createTextRange的text和htmlText

<script language="javascript">
function test()
{
var rng=document.body.createTextRange();
alert(rng.text)
}
function test1()
{
var rng=document.body.createTextRange();
alert(rng.htmlText)
}
</script>
<input type="button" onclick="test()" value="text">
<input type="button" onclick="test1()" value="htmlText">

--------------

页面文本倒序查找

abababababababa
<input value="倒序查找a" onclick=myfindtext("a") type="button">
<script language ='javascript'>
var rng = document.body.createTextRange();
function myfindtext(text)
{
rng.collapse(false);
if(rng.findText(text,-1,1))
{
rng.select();
rng.collapse(true);
}else
{alert("end");}
}
</script>

 

posted on 2008-08-25 21:16  sky100  阅读(343)  评论(0编辑  收藏  举报