首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

AlertBox在IE6上的应用

2012-11-01 
AlertBox在IE6下的应用最近需要在项目中的页面右下角做一个右下角弹出的例子,于是就在网上找到了AlertBox

AlertBox在IE6下的应用

最近需要在项目中的页面右下角做一个右下角弹出的例子,于是就在网上找到了AlertBox的小组件很不错,于是就拿来用。但是遇到了问题。在IE7下正常使用,但是就是在IE6下一直报脚本错误。

难道是IE6不支持?

但是下载的例子在IE6下可以弹出呀。就是把它改成jsp就报“AlertBox未定义”。最后经理告诉我,html既然能跑起来jsp就没问题。

最后发现是页面的字符集不一致的原因,特写出来给那些也喜欢这个组件但是还未这个问题郁闷的朋友们!

我改造过的能够定时弹出和关闭的一段代码:

?

<script type="text/javascript" language="javascript">  (function(){var timer, target, current,ab = new AlertBox("idBox2", {fixed: true,onShow: function(){clearTimeout(timer); this.box.style.bottom = this.box.style.right = 0;},    onClose: function(){ clearTimeout(timer); }});       function hide(){  ab.box.style.bottom = --current + "px";  if( current <= target ){  ab.close();   } else {  timer = setTimeout( hide, 10 );   }   }$$("idBoxClose2").onclick = function(){target = -ab.box.offsetHeight; current = 0; hide();}$$("idBoxOpen2").onclick = function(){ ab.show(); }      setTimeout("document.getElementById('idBoxOpen2').click();",5000);   setTimeout("document.getElementById('idBoxClose2').click();",15000);  })()</script>

?献丑了。

?

热点排行