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>

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com