上面已经说的很清楚了啊,是.不是/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>this is a test page for ajax</title>
<script language="javascript">function changeImage() {
alert("jklj");
alert(document.getElementById("image"));
document.getElementById("image").alt ="oooo";
}
</script>
</head>
<body>
<div id="map"><img id="image" src="http://zi.csdn.net/qihoo_300_60.gif" alt="map"/></div>
<input type="button" value="改变图像" onclick="changeImage();" />
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>this is a test page for ajax</title>
<script language="javascript">function changeImage() {
alert("jklj");
alert(document.getElementById("image"));
document.getElementById("image").alt ="oooo";
}
</script>
</head>
<body>
<div id="map"><img id="image" src="http://zi.csdn.net/qihoo_300_60.gif" alt="map"/></div>
<input type="button" value="改变图像" onclick="changeImage();" />
</body>
</html>
但是这句没起作用:document.getElementById("image").alt ="oooo";
把alt换成src图片应该有变化吧,可是没有。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>this is a test page for ajax</title>
<script language="javascript">function changeImage() {
alert("jklj");
alert(document.getElementById("image"));
document.getElementById("image").src ="http://community.csdn.net/logo/images/prj.210.67.gif";
}
</script>
</head>
<body>
<div id="map"><img id="image" src="http://zi.csdn.net/qihoo_300_60.gif" alt="map"/></div>
<input type="button" value="改变图像" onclick="changeImage();" />
</body>
</html>