源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> <script> function changeSize(){ document.getElementById("compman").height="250"; document.getElementById("compman").width="300"; } </script> </head> <body> <img id="compman" src="compman.gif" width="107" height="98"> <br><br> <input type="button" onclick="changeSize()" value="修改图像大小"> </body> </html>
运行结果