정말 도움이 될만한 또 다른 자바 스크립트 문제가 있습니다. 다시 바보 같은 질문에 대해 유감스럽게 생각합니다. 그러나 저는이 일에 정말로 새로운 것이며, 제가하고있는 일을 전혀 모릅니다. 지금까지 필자가 필요로하는 코드를 가지고 있으며 필자가 빠뜨린 정보를 스크립트에 기록했다.자바 스크립트 선택한 이미지 표시
감사합니다.
<HTML>
<HEAD>
<script>
//build a function named displayImage
//it should be catching the value of the item selected in a variable named whichImage
//use an if/else structure to test for whichImage not being equal to the string "noImage"
//if the statement is true then display the selected image in the canvas image
//if the statement is false then display the "blank.jpg" external file in the canvas image
//In the select tag below add an onChange event handler that calls the displayImage function
//the value property of the selection list should be passed to the displayImage function as it is called
//hint (this.value)
function displayImage(whichImage)
{
if(whichImage != "noImage")
{
document.canvas.src = whichImage;
}
else
{
document.canvas.src = "blank.jpg";
}
}
</script>
</HEAD>
<BODY>
<form name="imageForm">
<table border=3>
<tr>
<td>
<select name="imageSelector" onchange = "displayImage(this.value)">
<option value="noImage">Select an Animal
<option value="dog.jpg">Dog
<option value="cat.jpg">Cat
<option value="parrot.jpg">Parrot
<option value="fish.jpg">Fish
<option value="alligator.jpg">Alligator
<option value="mouse.jpg">Mouse
<option value="fox.jpg">Fox
</select>
</td>
</tr>
<tr>
<td>
<img src="blank.jpg" name="canvas">
</td>
</tr>
</table>
</form>
</BODY>
</HTML>
당신은 아무것도를 시도하거나 단지 우리가 당신을 위해 당신의 숙제/임무를 수행 할 수 있습니까? – dom
이 질문을보십시오 : [jQuery로 클릭 이미지에서 옵션으로 변경] (http://stackoverflow.com/questions/18183391/change-to-a-option-on-click-image-with-jquery) – shawnzhu