2013-07-14 25 views

回答

0

你实际上需要有几个图像。每次按下项目/按钮时,您都会将图像占位符中的图像更改为所需的图像HTML

// JS 
function changeImg() 
{ 
    // some logic like swicth to select the image 
    document.getElememtById("image_cont").innerHTML = "<img src='" + some_image + "'/>"; 
} 
// Html 
<div id="image_cont"></div> 
<button onclick="changeImg()">Change the Image</button> 

// so on 

然后你可以在你的函数中使用一些逻辑来选择你想要的图像。