Js实现鼠标滚轮放大缩小图片javascript
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>通过鼠标滚轮放大缩小图片</title>
<meta...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>通过鼠标滚轮放大缩小图片</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-size: 16px;
}
-->
</style>
</head>
<script language="javascript">
function bigimg(i)
{
var zoom = parseInt(i.style.zoom,10)||100;
zoom += event.wheelDelta / 12;
if(zoom > 0 )
i.style.zoom=zoom+'%';
return false;
}
</script>
<body>
<table width="100%">
<tr>
<td><span class="style1">请滚动鼠标滚轮</span></td>
</tr>
</table>
<center>
<a href="http://www.codefans.net">
<img src="http://www.codefans.net/jscss/demoimg/wall7.jpg" width="461" height="277" border="1" onmousewheel="return bigimg(this)">
</a>
</center>
</body>
</html>
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>通过鼠标滚轮放大缩小图片</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-size: 16px;
}
-->
</style>
</head>
<script language="javascript">
function bigimg(i)
{
var zoom = parseInt(i.style.zoom,10)||100;
zoom += event.wheelDelta / 12;
if(zoom > 0 )
i.style.zoom=zoom+'%';
return false;
}
</script>
<body>
<table width="100%">
<tr>
<td><span class="style1">请滚动鼠标滚轮</span></td>
</tr>
</table>
<center>
<a href="http://www.codefans.net">
<img src="http://www.codefans.net/jscss/demoimg/wall7.jpg" width="461" height="277" border="1" onmousewheel="return bigimg(this)">
</a>
</center>
</body>
</html>
上一篇:禁止按回车键提交表单
我要评论