几个对图形进行动态处理的DHTML代码
类别: JavaScript教程
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>
- 上一篇: 将站点加入频道栏源代码
- 下一篇: 用JAVASCRIPT隐藏超级链接的真实地址
-= 资 源 教 程 =-
文 章 搜 索