嗯,它是基本图像,然后在它上面是一堆空图像。当您更改设置时,每个都有一些 onChange 侦听器,它会更改src
这些空图像或其中一个……从而更改整体堆叠图像。
这是有关该概念的一些示例代码...在您的实现中,每个选择都会调整不同的图像(仅代表产品的相关部分):
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
#shell {width:100px;height:100px;display:block; background-color:#f00;}
#button {width:50px;height:50px;display:block; background-color:#00f;}
</style>
</head>
<body>
<div id="shell"><div id="button"></div></div>
Shell:
<select onChange="col('shell',this.value)">
<!-- in your version the values below would be file names of images -->
<option value="#f00">Red</option>
<option value="#0f0">Green</option>
<option value="#00f">Blue</option>
</select><br/>
Button:
<select onChange="col('button', this.value)">
<!-- in your version the values below would be file names of images -->
<option value="#00f">Blue</option>
<option value="#f00">Red</option>
<option value="#0f0">Green</option>
</select>
<script>
function col(part,x){
document.getElementById(part).style.backgroundColor=x;
//in yours, it would be document.getElementById(part).src=x;
}
</script>
</body>
</html>