国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開發(fā) > JS > 正文

jquery+json實(shí)現(xiàn)動(dòng)態(tài)商品內(nèi)容展示的方法

2024-05-06 16:27:52
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
這篇文章主要介紹了jquery+json實(shí)現(xiàn)動(dòng)態(tài)商品內(nèi)容展示的方法,涉及jQuery操作及解析json格式數(shù)據(jù)的相關(guān)技巧,需要的朋友可以參考下
 

本文實(shí)例講述了jquery+json實(shí)現(xiàn)動(dòng)態(tài)商品內(nèi)容展示的方法。分享給大家供大家參考,具體如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh" dir="ltr"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><mce:script type="text/javascript" src="jquery-1.4.4.min.js" mce_src="jquery-1.4.4.min.js"></mce:script><title>Example | xHTML1.0</title></head><mce:style><!--div{width:50px;height:50px;float:left;margin:10px; text-align:center;}.a{font-size:50px;float:left; cursor:pointer;}.b{font-size:50px;background-color:yellow;float:left; cursor:pointer;}.border{border:2px solid;}.bb{}--></mce:style><style mce_bogus="1">div{width:50px;height:50px;float:left;margin:10px; text-align:center;}.a{font-size:50px;float:left; cursor:pointer;}.b{font-size:50px;background-color:yellow;float:left; cursor:pointer;}.border{border:2px solid;}.bb{}</style><mce:script type="text/javascript"><!--$(function () {    var _json = {"red":{"small":"10","middle":"15","large":"20","max_large":"25"},"blue":{"small":"33","middle":"35","large":"9","max_large":"30"},"green":{"small":"34","middle":"30","large":"19","max_large":"3"},"orange":{"small":"9","middle":"15","large":"29","max_large":"18"}};   var _color_value;   var _size_value;   var _store_value;  $("#select_color div").click(function () {    $("#select_color div").attr("class","/bb");    $(this).attr("class","border");    _color_value = $(this).attr("date-value");    change_span_value()  });  $("#select_size div").click(function () {    $("#select_size div").attr("class","a");    $(this).attr("class","b");    _size_value = $(this).attr("date-value");    change_span_value()  });  function change_span_value() {    var _value = _json[_color_value][_size_value];    if (_value != undefined) {      $("#span_store").text(_value+"件");    }  }});// --></mce:script><body><div style="width:100%;margin:10px;" id="select_color"><div style="background-color:red;cursor:pointer;" mce_style="background-color:red;cursor:pointer;" date-value="red">Red</div><div style="background-color:blue;cursor:pointer;" mce_style="background-color:blue;cursor:pointer;" date-value="blue">Blue</div><div style="background-color:green;cursor:pointer;" mce_style="background-color:green;cursor:pointer;" date-value="green">Green</div><div style="background-color:orange;cursor:pointer;" mce_style="background-color:orange;cursor:pointer;" date-value="orange">Orange</div></div><div style="width:100%;margin:10px;" id="select_size"><div class="a" date-value="small">S</div><div class="b" date-value="middle">M</div><div class="a" date-value="large">L</div><div class="a" date-value="max_large">XL</div></div><div style="width:100%;margin:10px;text-align:left;" id="select_store">庫(kù)存:(<span id="span_store">1000件</span>)</div><div style="border:2px solid;width:100px;height:100px;background-color:gray"></div></body></html>

更多關(guān)于jQuery操作json相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery操作json數(shù)據(jù)技巧匯總

希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。



注:相關(guān)教程知識(shí)閱讀請(qǐng)移步到JavaScript/Ajax教程頻道。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 南阳市| 新安县| 犍为县| 合阳县| 禄丰县| 阜新市| 舒兰市| 隆德县| 诏安县| 临泉县| 邵东县| 沁源县| 正定县| 盘山县| 巴青县| 赤壁市| 顺昌县| 盐池县| 新郑市| 石首市| 白水县| 宁河县| 甘洛县| 西乌| 崇仁县| 获嘉县| 比如县| 察雅县| 西安市| 河曲县| 介休市| 治多县| 德庆县| 平邑县| 新干县| 凤翔县| 星座| 江西省| 罗山县| 彭州市| 昭觉县|