码迷,mamicode.com
首页 > 其他好文 > 详细

品牌展示与回收,添加到筛选

时间:2015-07-08 20:33:27      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:

.cshtml

技术分享
 1  <div class="secect_r">
 2         <div class="top_right">
 3             <ul>
 4                 <li class="list1"><img src="~/MvcImages/ycysqd/sx_03.gif" /><p>筛选</p></li>
 5                 <li class="list2"><a href="">集成电路</a>&gt;&gt;</li>
 6                 @*<li class="list3"><a>INFINEON</a><span>&times;</span></li>
 7                 <li class="list3"><a>100-1000件</a><span>&times;</span></li>
 8                 <li class="list3"><a>国内</a><span>&times;</span></li>*@
 9             </ul>
10             <div class="r1"><h1>型号:</h1><div class="text1"><input id="typeofproduct" type="text" value="输入型号" /></div></div>
11             <div class="r2"><h1>品牌:</h1><div class="text2" id="r2_text2"><h2 class="cur1">全部</h2><h2>FTDI</h2><h2>WIINET</h2><h2>3M-STATIC CONTROL SOLUTIONS</h2><h2>AAVID THERMALLOY</h2><h2>ALLIANCE</h2><a href="javascript:void(0);" id="more_r2" onclick="More_r2()">更多+</a></div><div class="text2" id="r2_text2_2" style="display:none"></div></div>
12             <div class="r3"><h1>库存数量:</h1><div class="text1"><input type="text" class="ChangeInventoryquantity" id="startnumber" value="1000" /></div><a>-</a><div class="text2"><input class="ChangeInventoryquantity" id="endnumber" type="text" value="1000000" /></div><a>件</a></div>
13             <div class="r4"><h1>交货地:</h1><div class="text2"><h2 class="cur1">全部</h2><h2 onclick="Trademark(this)">国内</h2><h2 onclick="Trademark(this)">香港</h2></div></div>
14         </div>
15 
16     </div>
17     <table class="bottom_right">
18         <tr class="tr1">
19             <td class="td1"><p>型号</p></td>
20             <td class="td2"><p>品牌</p></td>
21             <td class="td3"><p>库存数量</p></td>
22             <td class="td4"><p>货期</p></td>
23             <td class="td5"><p>起订量</p></td>
24             <td class="td6"><p>交货地</p></td>
25             <td class="td7"><p>香港交货</p></td>
26             <td class="td8"><p>国内交货</p></td>
27             <td class="td9"><p>操作</p></td>
28         </tr>
29         <tr class="tr2">
30             <td></td>
31             <td></td>
32             <td></td>
33             <td><p>(工作日)</p></td>
34             <td></td>
35             <td></td>
36             <td></td>
37             <td><p>(含17%税)</p></td>
38             <td></td>
39         </tr>
40 
41         <tbody class="tr3"></tbody>
42 
43     </table>
View Code

js

技术分享
 1 //品牌--收回
 2 function RegainTrademarkClick() {
 3     //function PostParam(param) {
 4     //    param.key = "lm324";
 5     //    return param;
 6     //}
 7     //var PostExecParam = {
 8     //    ClassName: "AnxinE.BLL.Product.ProductInfoBLL",
 9     //    MethodName: "Search",
10     //    ParamModelName: "AnxinE.Model.Product.ProductInfoParam",
11     //    onRequest: PostParam,
12     //    onResponse: function (result) {
13     //        if (result != null) {
14     //            var html2 = "";
15     //            if (result.ManufacturerList.length > 0) {
16 
17     //                for (var i = 0; i < 4 ; i++) {
18     //                    if (result.ManufacturerList[i].KeyName != null) {
19     //                        html2 += "<h2  href=‘javascript:void(0);‘ id=‘" + result.ManufacturerList[i].KeyName + "‘ onclick=‘Trademark(this)‘ >" + result.ManufacturerList[i].KeyName + "</h2>";
20     //                    }
21     //                }
22     //                html2 += "<a href=‘javascript:void(0);‘ id=‘more_r2‘ onclick=‘More_r2()‘>更多+</a>";
23     //            }
24     //            $("#r2_text2").empty();
25     //            $("#r2_text2").append(html2);
26     //        }
27     //    }
28     //}
29     //$.ajaxRequest(PostExecParam);
30 
31     //添加到第一个div中一个a标签
32     var html = "<a href=‘javascript:void(0);‘ id=‘more_r2‘ onclick=‘More_r2()‘>更多+</a>";
33     $("#r2_text2").append(html);
34     var objid = document.getElementById("r2_text2_2");
35     //隐藏第二个div
36     objid.style.display = "none";
37 }
38 //异步实现品牌展开
39 function More_r2() {
40     //第二次点击“更多”直接展开隐藏div
41     if ($("#r2_text2_2").text() != "") {
42         $("#r2_text2 a").remove();
43         var objid = document.getElementById("r2_text2_2");
44         //打开第二个div
45         objid.style.display = "block";
46     } else {//第一次点击更多时ajax加载并且填充第二个div
47         function PostParam(param) {
48             param.key = "lm324";
49             return param;
50         }
51         var PostExecParam = {
52             ClassName: "AnxinE.BLL.Product.ProductInfoBLL",
53             MethodName: "Search",
54             ParamModelName: "AnxinE.Model.Product.ProductInfoParam",
55             onRequest: PostParam,
56             onResponse: function (result) {
57                 if (result != null) {
58                     var html2 = "";
59                     var html3 = "";
60                     if (result.ManufacturerList.length > 0) {
61                         for (var i = 0; i < result.ManufacturerList.length ; i++) {
62                             if (result.ManufacturerList[i].KeyName != null) {
63                                 if (i < 5) {
64                                     html2 += "<h2  href=‘javascript:void(0);‘ id=‘" + result.ManufacturerList[i].KeyName + "‘ onclick=‘Trademark(this)‘ >" + result.ManufacturerList[i].KeyName + "</h2>";
65                                 } else {
66                                     html3 += "<h2  href=‘javascript:void(0);‘ id=‘" + result.ManufacturerList[i].KeyName + "‘ onclick=‘Trademark(this)‘ >" + result.ManufacturerList[i].KeyName + "</h2>";
67                                 }
68 
69                             }
70                         }
71                         //<a href="javascript:void(0);" id="regain_r2">收回</a>
72                         //html2 += "<a id=‘regain_r2‘ href=‘javascript:void(0);‘ onclick=‘RegainTrademarkClick()‘>收回</a>";
73                         html3 += "<a id=‘regain_r2‘ href=‘javascript:void(0);‘ onclick=‘RegainTrademarkClick()‘>收回</a>";
74                     }
75                     $("#r2_text2").not($(".cur1")).empty();
76                     $("#r2_text2").append(html2);
77                     $("#r2_text2_2").append(html3);//向第二个div中写数据
78                     var objid = document.getElementById("r2_text2_2");
79                     objid.style.display = "block";
80                 }
81             }
82         }
83         $.ajaxRequest(PostExecParam);
84     }
85 }
86 //点击品牌加载到筛选
87 function Trademark(obj) {
88     var value1 = null;
89     if (obj) {
90         value1 = obj.innerText;
91     }
92     //筛选项中有了重复的内容的就不再加载
93     var v = $(".list3").find("a").text();
94     if (v.indexOf(value1) > -1) {
95         //$("#deleteparent" + value1 + "").parent().remove();
96     } else {
97         $(".top_right ul").append("<li class=‘list3‘ onclick=‘DeleteTrademark(this)‘><a id=‘deleteparent" + value1 + "‘>" + value1 + "</a><span >&times;</span></li>");
98     }
99 }
View Code

 

品牌展示与回收,添加到筛选

标签:

原文地址:http://www.cnblogs.com/zhaokunbokeyuan256/p/4631095.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!