我有一个程序可以模拟具有正面图像和背面图像的传单的折叠效果。我通过 dropDownList 选择传单。如何在标签中传递背面图像,以便在旋转图像时显示背面的图片?
这是我的 dropDownList 的 HTML:
<form name="Pictures">
<select name="dropPic" onchange="selectFront(this.value)">
<option value="Flyer1pag1.png" value="Flyer1pag2.png">Flyer 1</option>
<option value="Flyer2pag1.png" value="Flyer1pag2.png">Flyer 2</option>
<option value="Flyer3pag1.png" value="Flyer1pag2.png">Flyer 3</option>
</select>
</form>Run Code Online (Sandbox Code Playgroud)
这是 JavaScript 中的函数,用于更改有关 dropDownList 选择的正面图像以及应获取传单背面图像的函数:
function selectFront(imgSrc) {
loadImage(imgSrc);
var Dim_Slice = document.querySelectorAll(".slice");
for (var i = 0; i < Dim_Slice.length; i++) {
Dim_Slice[i].style.backgroundImage = "url(" + imgSrc + ")";
}
}
function selectBack(imgSrc) {
var Dim_Sliceb = document.querySelectorAll(".sliceb");
for (var i = 0; i < Dim_Sliceb.length; i++) {
Dim_Sliceb[i].style.backgroundImage = "url(" + imgSrc …Run Code Online (Sandbox Code Playgroud)