您的位置:首页 > 编程语言

图片大小随鼠标滚动而改变的兼容IE和firefox的代码

2007-07-14 22:06 633 查看
搞了半天,终于搞定,但是在firefox下面显示效果不是很好,代码如下:(后面附上注明几点)

1<html>
2<head>
3 <title>无标题页</title>
4</head>
60<body>
61 <form id="form1" runat="server">
62 <div>
63 <div id="div1"
64 <table class="tablebody2" style="table-layout:fixed;" border="0" width="90%">
65 <tr>
66 <td>
67 <img id="11" src="UserFolder/00.jpg" onclick="javascript:window.open(this.src);"
68style="cursor: pointer;" onload="javascript:if(this.width>screen.width-500)this.style.width=screen.width-500;"
69onmousewheel="return bbimg(this)" border="0" />
70 </td>
71 </tr>
72 </table>
73 </div>
74 </form>
75</body>
76</html>
77
78

在上面的代码里,我首先把判断IE捕捉IE鼠标滚动事件的代码去掉了,因为如果不去掉效果和去掉以后直接写
onmousewheel="return bbimg(this)"的运行效果要相差很远;
还有一点就是方了个table,加上了style="table-layout:fixed;属性,如果不用table用div我找不到任何样式来控制当这个图片月滚越大的时候会把所有的页面样式都搞坏;

页面图片效果可以在一诺操盘手网预览!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: