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>

 献丑了。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值