JavaScript在IE地址栏中的妙用

来源:互联网 发布:excel两列数据求和 编辑:程序博客网 时间:2024/05/16 11:45

完全打开页面后,在该页的在IE地址栏 或 按Ctrl+O 输入以下代码,回车,就可以得到相应的效果:

1.显示网页中的所有图片
javascript:Ai7Mg6P='';for%20(i7M1bQz=0;i7M1bQz<document.images.length;i7M1bQz++){Ai7Mg6P+='<img%20src='+document.images[i7M1bQz].src+'><br>'};if(Ai7Mg6P!=''){document.write('<center>'+Ai7Mg6P+'</center>');void(document.close())}else{alert('No%20images!')}

2.显示网页中除图片的其他
javascript:for(jK6bvW=0;jK6bvW<document.images.length;jK6bvW++){void(document.images[jK6bvW].style.visibility='hidden')}

3.显示网页源代码(对于加密过的可以直接显示其加密前的源代码)
javascript:s=document.documentElement.outerHTML;document.write('<body></body>');document.body.innerText=s;

4.网页放大1.5倍
javascript:void(s=document.body.style);void(z=s.getAttribute('zoom'));if(z){s.setAttribute('zoom',(parseInt(z)+50)+'%');}else s.setAttribute('zoom','150%')

5.网页缩小0.5倍
javascript:void(s=document.body.style);void(z=s.getAttribute('zoom'));if(z){s.setAttribute('zoom',(parseInt(z)-50)+'%');}else s.setAttribute('zoom','50%')

6.用IE做简单计算
在地址栏中输入“javascript:alert(1.2*50+50*3/10) ”,然后按下回车键,出现的是“1.2*50+50*3/10”的结果“75”

原创粉丝点击