几个对图形进行动态处理的dhtml代码
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>
注意,图形文件换成自己的文件,试试,不错吧
<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>
注意,图形文件换成自己的文件,试试,不错吧
版权声明:本文由驱动中国整理发布,转载需注明出处与原文链接。如有疑问请联系
editor@qudong.com。
本文价值
★★★★★
—
成为第一个评分的人
登录后为本文打分
评论加载中…