我已经这个加载之前与相应的颜色变量中的单选按钮:如何将JSON URL传递给jQuery函数?
<script type="text/javascript">
//<![CDATA[
images = {"Black":"http:\/\/ecx.images-amazon.com\/images\/I\/31XwBA2m8pL.jpg", "Slate":"http:\/\/ecx.images-amazon.com\/images\/I\/31SqWkrSb6L.jpg", "White":"http:\/\/ecx.images-amazon.com\/images\/I\/31OJufgJT2L.jpg"};
//]]>
</script>
这里是jQuery函数。目前为止我能做的最好的事情是让第一个图像消失,留下alt
属性。
function change_large_product_image(url) {
jQuery('.largeprod img').attr('src', url);
return false;
}
以下是单选按钮的示例源。
<label for="Black"
style="background: #fff url(http://ecx.images-amazon.com/images/I/11TeKFAzJsL._SL30_.jpg) center center no-repeat;"
title="Black" >
Black
</label>
<input
id="color_black"
name="color"
onclick="change_large_product_image(images['Black'])"
type="radio"
value="Black" />
这是什么做的?你想做什么? – 2009-02-04 21:09:09