我有这个http://jsfiddle.net/TtX7F/1/但我不知道如何让它在 weebly 中工作。HTML 部分有效,但 js 仅在编辑时有效,而不是在发布时有效,我不知道将 CSS 放在哪里。
这是javascript
$("input").on("click", color);
$(document).ready(color);
function color() {
var shell = $("[name='shell']:checked").val(),
thumbs = $("[name='thumbs']:checked").val(),
result = {
"shell": "",
"thumbs": ""
};
switch (true) {
case (shell === "black"):
result.shell = "http://liberatedinamerica.com/wp-content/uploads/2013/05/shell-black.png";
break;
case (shell === "blue"):
result.shell = "http://liberatedinamerica.com/wp-content/uploads/2013/05/shell-blue.png";
break;
case (shell === "pink"):
result.shell = "http://liberatedinamerica.com/wp-content/uploads/2013/05/shell-pink.png";
break;
}
switch (true) {
case (thumbs === "red"):
result.thumbs = "http://liberatedinamerica.com/wp-content/uploads/2013/05/ey-thumbs-ps3-red.png";
break;
case (thumbs === "lime"):
result.thumbs = "http://liberatedinamerica.com/wp-content/uploads/2013/05/ey-thumbs-ps3-lime.png";
break;
}
$(".shell").attr("src", result.shell);
$(".thumbs").attr("src", result.thumbs);
console.log(result);
}