JS控制图片大小,但是图片首次加载不能显示,需要刷新后才会正常,急急急啊
发布网友
发布时间:2022-04-24 18:46
我来回答
共1个回答
热心网友
时间:2023-11-03 10:56
<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8 />
<title>Nothing</title>
<style type="text/css">
</style>
</head>
<body>
<input name="proctImage" type="image" id="proctImage" src="images/aaa.jpg" onmouseover="move(this)" onmouseout="out(this)">
<script type="text/javascript">
proctImage.onload = function ()
{
loading (this);
}
var loading = function (proctImage)
{
var w = proctImage.width;
var h = proctImage.height;
proctImage.height = h * 0.5;
proctImage.width = w * 0.5;
}
function move (proctImage)
{
proctImage.height *= 2;
proctImage.width *= 2;
}
function out (proctImage)
{
proctImage.height *= 0.5;
proctImage.width *= 0.5;
}
</script>
</body>
</html>
热心网友
时间:2023-11-03 10:56
<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8 />
<title>Nothing</title>
<style type="text/css">
</style>
</head>
<body>
<input name="proctImage" type="image" id="proctImage" src="images/aaa.jpg" onmouseover="move(this)" onmouseout="out(this)">
<script type="text/javascript">
proctImage.onload = function ()
{
loading (this);
}
var loading = function (proctImage)
{
var w = proctImage.width;
var h = proctImage.height;
proctImage.height = h * 0.5;
proctImage.width = w * 0.5;
}
function move (proctImage)
{
proctImage.height *= 2;
proctImage.width *= 2;
}
function out (proctImage)
{
proctImage.height *= 0.5;
proctImage.width *= 0.5;
}
</script>
</body>
</html>
热心网友
时间:2023-11-03 10:56
<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8 />
<title>Nothing</title>
<style type="text/css">
</style>
</head>
<body>
<input name="proctImage" type="image" id="proctImage" src="images/aaa.jpg" onmouseover="move(this)" onmouseout="out(this)">
<script type="text/javascript">
proctImage.onload = function ()
{
loading (this);
}
var loading = function (proctImage)
{
var w = proctImage.width;
var h = proctImage.height;
proctImage.height = h * 0.5;
proctImage.width = w * 0.5;
}
function move (proctImage)
{
proctImage.height *= 2;
proctImage.width *= 2;
}
function out (proctImage)
{
proctImage.height *= 0.5;
proctImage.width *= 0.5;
}
</script>
</body>
</html>
热心网友
时间:2023-11-03 10:56
<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8 />
<title>Nothing</title>
<style type="text/css">
</style>
</head>
<body>
<input name="proctImage" type="image" id="proctImage" src="images/aaa.jpg" onmouseover="move(this)" onmouseout="out(this)">
<script type="text/javascript">
proctImage.onload = function ()
{
loading (this);
}
var loading = function (proctImage)
{
var w = proctImage.width;
var h = proctImage.height;
proctImage.height = h * 0.5;
proctImage.width = w * 0.5;
}
function move (proctImage)
{
proctImage.height *= 2;
proctImage.width *= 2;
}
function out (proctImage)
{
proctImage.height *= 0.5;
proctImage.width *= 0.5;
}
</script>
</body>
</html>