求教下高手,我用JAVASCRIPT做了一个类似蒙板的效果,IE7可以出现效果,但是火狐和IE7以下版本的浏览器都无法实现效果,请问是为何?
源代码<script language="javascript" type="text/javascript">
var time=0;
var Opacity=0;
var x,y;
var iditem;
function MouseOver(idname,str)
{
x = document.documentElement.scrollLeft+event.x
y = document.documentElement.scrollTop+event.y
if(str=="up")
{
window.clearInterval(time)
iditem=idname;
oDiv.style.display = "block"
document.getElementById(iditem).style.zIndex=20;
time=window.setInterval("aa()",1);
}
else if(str=="down")
{
window.clearInterval(time)
b1d.style.display="none"
time = window.setInterval("bb()", 1);
document.getElementById(iditem).style.zIndex=1;
}
}
function aa()
{
if (Opacity == 50)
{
window.clearInterval(time)
if(x>800)
{
b1d.style.left=x-250;
b1d.style.top=y;
}
else
{
b1d.style.left=x;
b1d.style.top=y;
}
getid()
b1d.style.display="block"
return
}
Opacity = ( Opacity + 25 ) > 50 ? 50 : Opacity + 25
oDiv.style.filter = "Alpha(Opacity=" + Opacity + ")"
}
function bb()
{
if (Opacity == 0)
{
window.clearInterval(time)
oDiv.style.display = "none"
return
}
Opacity = ( Opacity - 25 < 0) ? 0 : Opacity - 25
oDiv.style.filter = "Alpha(Opacity=" + Opacity + ")"
}
function getid()
{
switch(iditem.substr(0,3))
{
case "itm":document.getElementById("money").innerHTML="商品招标 1000RMB/月";break;
}
}
</script>
源代码<script language="javascript" type="text/javascript">
var time=0;
var Opacity=0;
var x,y;
var iditem;
function MouseOver(idname,str)
{
x = document.documentElement.scrollLeft+event.x
y = document.documentElement.scrollTop+event.y
if(str=="up")
{
window.clearInterval(time)
iditem=idname;
oDiv.style.display = "block"
document.getElementById(iditem).style.zIndex=20;
time=window.setInterval("aa()",1);
}
else if(str=="down")
{
window.clearInterval(time)
b1d.style.display="none"
time = window.setInterval("bb()", 1);
document.getElementById(iditem).style.zIndex=1;
}
}
function aa()
{
if (Opacity == 50)
{
window.clearInterval(time)
if(x>800)
{
b1d.style.left=x-250;
b1d.style.top=y;
}
else
{
b1d.style.left=x;
b1d.style.top=y;
}
getid()
b1d.style.display="block"
return
}
Opacity = ( Opacity + 25 ) > 50 ? 50 : Opacity + 25
oDiv.style.filter = "Alpha(Opacity=" + Opacity + ")"
}
function bb()
{
if (Opacity == 0)
{
window.clearInterval(time)
oDiv.style.display = "none"
return
}
Opacity = ( Opacity - 25 < 0) ? 0 : Opacity - 25
oDiv.style.filter = "Alpha(Opacity=" + Opacity + ")"
}
function getid()
{
switch(iditem.substr(0,3))
{
case "itm":document.getElementById("money").innerHTML="商品招标 1000RMB/月";break;
}
}
</script>
解决方案 »
- JQ在单选按钮点击后,改变单选项的字体和背景,再在后面显示他选择内容
- 如何模拟IE窗口
- 比较两数大小
- 在菜单技术里面经常看到这样的代码,不明白什么意思。
- 怎样用正则表达式匹配一个合法的IP 地址????
- 有谁知道这个JavaScript函数的作用?
- 急,如何把弹出窗口定位在屏幕的中央????解决了马上给分
- 关于在jsp中的javascript代码。
- 从iframe中打开一个新窗口,然后从新窗口中向原iframe中传值得问题,在线等待.....
- 我这if中的javascript为何不执行,直接到else了.谢!
- 怎样实现javasccript的智能化 和工业化??
- 为什么全局变量 没有赋值成功(或者说又被刷回初值了?)
就知道FF肯定不行!!呵呵!FF不支持event这种用法