我不是一个 javascript 编码器,所以我正在向任何可以帮助我解决我遇到的问题的人寻求任何建议,主要问题是我正在尝试交换图像,以便可以通过选择来选择它们单选按钮。
<script language="JavaScript">
function changeImage(newImage)
{
if document[imageName].src = eval(newImage + ".src");
}
var img00700000232 = new Image();
img00700000232.src = "/2/00700000232.jpg";
var img00700000263 = new Image();
img00700000263.src = "/2/00700000263.jpg";
var img00700000270 = new Image();
img00700000270.src = "/2/00700000270.jpg";
var img00700000133 = new Image();
img00700000133.src = "images/TempImage.png";
var img00700000164 = new Image();
img00700000164.src = "images/TempImage.png";
var img00700000140 = new Image();
img00700000140.src = "images/TempImage.png";
var img00700000157 = new Image();
img00700000157.src = "images/TempImage.png";
</script>
</head><body>
<form name="test">
<input name="field" type="radio" value="00700000232" onchange="changeImage('img00700000232');">Prod1</input>
<br/>
<input name="field" type="radio" value="00700000263" onchange="changeImage('img00700000263');">Prod2</input>
<br/>
<input name="field" type="radio" value="00700000270" onchange="changeImage('img00700000270');">Prod3</input>
<br/>
<input name="field" type="radio" value="00700000133" onchange="changeImage('img00700000133');">Prod4</input>
<br/>
<input name="field" type="radio" value="00700000164" onchange="changeImage('img00700000164');">Prod5</input>
<br/>
<input name="field" type="radio" value="00700000140" onchange="changeImage('img00700000140');">Prod6</input>
<br/>
<input name="field" type="radio" value="00700000157" onchange="changeImage('img00700000157');">Prod7</input>
<br/>
</form>
<img name="image_name" src="images/TempImage.png" />
这是从 ASP 经典生成的代码,因此代码是在服务器端生成的,所以我不确定这是否是一个问题,或者我的代码是否有问题,任何和所有的帮助都将不胜感激。
谢谢布拉德