日期:2014-05-16 浏览次数:20483 次
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>未命名頁面</title>
    
<script language="javascript" type="text/javascript">
// <!CDATA[
function Button1_onclick() {
document.getElementById('img1').style.height=30;
document.getElementById('img1').style.width=30;
}
// ]]>
</script>
</head>
<body>
    <form id="form1" runat="server">
    <img id="img1" src="Image/P2P_1.jpg"/>
        <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />
    
    </form>
</body>
</html>
------解决方案--------------------
document.getElementById("Img1").style.width=100; 
document.getElementById("Img1").style.height=100;
------解决方案--------------------
没问题啊,不过最好是设置style中的width和height
<html>
<head>
<title></title>
</head>
<body>
<input type='button' onclick='setSize()' value='重新设置'/><br/>
<script>
function setSize()
{
  var im=document.getElementById("img1");
  im.width=100;
  im.height=100;
}
</script>
<img id='img1' src='xx1.gif'/>
</body>
</html>