<html>
<head>
<title>First Web for Hyman</title>
</head>
<script>
function submitFrom()
{
if(!document.getElementById("pname").value)
{ alert("请输入图片名称!"); document.getElementById("pname").focus(); return; } else { document.getElementById("pic").src=document.getElementById("pname").value+".png"; //document.getElementById("pic").src="2.png"; } } </script> <body> <table> <tr> <td> <Img id="pic" src=""/>
</td>
<td>
Pic Name:<br>
<input id="pname" type="text" value="Hyman">
<br>
<input type="submit" value="Submit" οnclick="submitFrom()">
</td>
</tr>
</table>
</body>
</html>
The original version of js to switch pictures
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=324490314&siteId=291194637
Recommended
Ranking