几个对图形进行动态处理的dhtml代码
发布时间:2006-10-14 2:44:25   收集提供:gaoqian
1)<html>
<head>

<script language="javascript">
function setHeight()
{
var x=document.images
x[0].height="250"
}
</script>

</head>
<body>

<img src="../images/compman.gif" width="107" height="98" />

<form>
<input type="button" onclick="setHeight()" value="Change height">
</form>

</body>
</html>

2)<html>
<head>

<script language="JavaScript">
function setSrc()
{
var x=document.images
x[0].src="../images/hackanm.gif"
}
</script>

</head>
<body>

<img src="../images/compman.gif" width="107" height="98" />

<form>
<input type="button" onclick="setSrc()" value="Change image">
</form>

</body>
</html>
3)<html>
<head>

<script language="JavaScript">
function setWidth()
{
var x=document.images
x[0].width="300"
}
</script>

</head>
<body>

<img src="../images/compman.gif" width="107" height="98" />

<form>
<input type="button" onclick="setWidth()" value="Change width">
</form>

</body>
</html>

注意,图形文件换成自己的文件,试试,不错吧
 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50