jsp+php做一个选购T恤的网页。可以选择T恤的底色、图案和自己输入文字,其中文字也可以选择字体颜色和大小。
怎样可以实现随时观察已选择的T恤样式(底色+图案+文字)
我保存了不同底色t恤的图片,用的radio button选择
function backgroundChoice (bgColor) {
switch (bgColor) {
case "White":
document.getElementById("bgColor").src = "T_White.png";
//document.getElementById("designP").value = "This is Design 1";
break;
case "Yellow":
document.getElementById("bgColor").src = "T_Yellow.png";
// document.getElementById("designP").value = "This is Design 2";
break;
case "Blue":
document.getElementById("bgColor").src = "T_Blue.png";
// document.getElementById("designP").value = "This is Design 3";
break;
case "Green":
document.getElementById("bgColor").src = "T_Green.png";
// document.getElementById("designP").value = "This is Design 4";
break;
case "Pink":
document.getElementById("bgColor").src = "T_Pink.png";
// document.getElementById("designP").value = "This is Design 5";
break;
case "Red":
document.getElementById("bgColor").src = "T_Red.png";
// document.getElementById("designP").value = "This is Design 6";
break;
case "Purple":
document.getElementById("bgColor").src = "T_Purple.png";
// document.getElementById("designP").value = "This is Design 7";
break;
case "Gray":
document.getElementById("bgColor").src = "T_Gray.png";
// document.getElementById("designP").value = "This is Design 8";
break;
------解决方案--------------------
var backGround = {
White : 'T_White.png',
Yellow : 'T_Yellow.png',
Blue : 'T_Blue.png',
Green : 'T_Green.png',
Pink : 'T_Pink.png',
Red : 'T_Red.png',
Purple : 'T_Purple.png',
Gray : 'T_Gray.png'