javascript 使用下拉列表改变图像,请帮我找一下哪儿出错了,非常感谢!
javascript使用下拉列表改变图像,请帮我找一下哪儿出错了,非常感谢!<html><head><metahttp-equiv="Content-Type"conte...
javascript 使用下拉列表改变图像,请帮我找一下哪儿出错了,非常感谢!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>4</title>
</head>
<body>
<script language="javascript">
function showImage(){
document.im.src="images"+document.myForm.sell.value+ "jpg";}
</script>
<table>
<form action="" method="POST" name="myForm"> <tr>
<td><select name="sell" onchange="showImage()">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select></td>
<td><img src="images\1.jpg" name="im"> </td> </tr>
</form>
</table>
</body>
</html> 展开
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>4</title>
</head>
<body>
<script language="javascript">
function showImage(){
document.im.src="images"+document.myForm.sell.value+ "jpg";}
</script>
<table>
<form action="" method="POST" name="myForm"> <tr>
<td><select name="sell" onchange="showImage()">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select></td>
<td><img src="images\1.jpg" name="im"> </td> </tr>
</form>
</table>
</body>
</html> 展开
1个回答
展开全部
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>4</title>
</head>
<body>
<script language="javascript">
function showImage(){
document.getElementById('im').setAttribute('src',"images/"+document.getElementById('sell').value+ ".jpg");}
</script>
<table>
<form action="" method="POST" id="myForm"> <tr>
<td><select id="sell" onchange="showImage()">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select></td>
<td><img src="images\1.jpg" id="im"> </td> </tr>
</form>
</table>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>4</title>
</head>
<body>
<script language="javascript">
function showImage(){
document.getElementById('im').setAttribute('src',"images/"+document.getElementById('sell').value+ ".jpg");}
</script>
<table>
<form action="" method="POST" id="myForm"> <tr>
<td><select id="sell" onchange="showImage()">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select></td>
<td><img src="images\1.jpg" id="im"> </td> </tr>
</form>
</table>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询