★★ 在网页中调用IE的内部命令 ★★

 

 

在网页中调用IE的内部命令

【孟宪会之精彩世界】 http://go.163.com/colorweb

在IE4+的网页中,使用IE的内部命令,可以实现一些常用的命令:如打印、刷新等。语法如下:


  bSuccess = object.execCommand(sCommand [, bUserInterface] [, vValue])

其中:bSuccess是返回值:true 或 false

   sCommand是命令字符串。

   bUserInterface是可选项,true 或 false。

   vValue是可选项,是逻辑值,数字、字符串等[根据命令类型而定]。

<style> blockquote {background-color:#0099ff;padding-left:20px;padding-top:10px;padding-bottom:10px;padding-right:10px} </style>
例子如下:

<script> function test(){ if(document.queryCommandSupported('Print')) alert("支持Print命令!") else alert("不支持Print命令!") } </script>








<style> .spanstyle { position:absolute; visibility:visible; top:-50px; font-size:11pt; font-family:宋体; font-weight:bold; } </style> <script> var message="★ ★ ★ ★ 欢 迎 光 临 孟 宪 会 之 精 彩 世 界! [ http://lucky.myrice.com ] ★ ★ ★ ★ " message=message.split(" ") var step=8 var stepbasic=12 var x,y var flag=0 var xpos=new Array() for (i=0;i<=message.length-1;i++) { xpos[i]=-100 } var ypos=new Array() for (i=0;i<=message.length-1;i++) { ypos[i]=-100 } var spacebetweenwords=new Array() for (i=0;i<=message.length-1;i++) { spacebetweenwords[i]=stepbasic+step*message[i].length-1 } var colorstep=Math.round(255/message.length-1) var colorrgb=new Array() for (i=0;i<=message.length-1;i++) { colorrgb[i]=i*colorstep } var wordcolor=new Array() for (i=0;i<=message.length-1;i++) { var colhex_left = Math.floor(colorrgb[i]/16) var colhex_right= colorrgb[i]-(colhex_left*16) if (colhex_left == 10) {colhex_left="A"} if (colhex_left == 11) {colhex_left="B"} if (colhex_left == 12) {colhex_left="C"} if (colhex_left == 13) {colhex_left="D"} if (colhex_left == 14) {colhex_left="E"} if (colhex_left == 15) {colhex_left="F"} if (colhex_right == 10) {colhex_right="A"} if (colhex_right == 11) {colhex_right="B"} if (colhex_right == 12) {colhex_right="C"} if (colhex_right == 13) {colhex_right="D"} if (colhex_right == 14) {colhex_right="E"} if (colhex_right == 15) {colhex_right="F"} wordcolor[i] =""+colhex_left+colhex_right } function handlerMM(e){ x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY flag=1 } function makesnake() { if (flag==1 && document.all) { for (i=message.length-1; i>=1; i--) { xpos[i]=xpos[i-1]+spacebetweenwords[i-1] ypos[i]=ypos[i-1] } xpos[0]=x+stepbasic ypos[0]=y for (i=0; i<message.length-1; i++)="" {="" var="" thisspan="eval(&quot;span&quot;+(i)+&quot;.style&quot;)" thisspan.posleft="xpos[i]" thisspan.postop="ypos[i]" }="" }="" else="" if="" (flag="=1" &&="" document.layers)="" {="" for="" (i="message.length-1;" i="">=1; i--) { xpos[i]=xpos[i-1]+spacebetweenwords[i-1] ypos[i]=ypos[i-1] } xpos[0]=x+stepbasic ypos[0]=y for (i=0; i<message.length-1; i++)="" {="" var="" thisspan="eval(&quot;document.span&quot;+i)" thisspan.left="xpos[i]" thisspan.top="ypos[i]" }="" }="" var="" timer="setTimeout(&quot;makesnake()&quot;,30)" }="" <="" script=""> <style> body{width:100%;overflow-x:hidden;overflow-y:scroll} </style> <script> makesnake() </script> 界! [ http://lucky.myrice.com ] 界! [ http://lucky.myrice.com ]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值