先來看效果 然后上代碼: 先來DIV代碼 <!-- 分類篩選 --> <div class="my-3"> <div class="row"> <div class="col-12 col-sm-2 col-md-1">類型:</div> <div class="col-12 col-sm-10 col-md-11"> <select class="footer_sel" id="FriendLink"> <option selected="selected" value="#">選擇分類</option> {pboot:select field=ext_type} <option {pboot:if('[select:value]'=='[select:current]' )}selected="selected" {/pboot:if} value="[select:link]">[select:value]</option> {/pboot:select} </select> </div> </div> <div class="row"> <div class="col-12 col-sm-2 col-md-1">顏色:</div> <div class="col-12 col-sm-10 col-md-11"> <select class="footer_sel" id="FriendLink2"> <option selected="selected" value="#">選擇分類</option> {pboot:select field=ext_color} <option {pboot:if('[select:value]'=='[select:current]' )}selected="selected" {/pboot:if} value="[select:link]">[select:value]</option> {/pboot:select} </select> </div> </div> </div> 然后JQ代碼 <script> (function(window, $) { function init() { bindEvt(); } init(); function bindEvt() { $("#FriendLink").bind("change", function() { var selectedHref = $("#FriendLink :selected").val(); if (selectedHref != "") { window.open(selectedHref, "_self"); } }); } function init2() { bindEvt2(); } init2(); function bindEvt2() { $("#FriendLink2").bind("change", function() { var selectedHref = $("#FriendLink2 :selected").val(); if (selectedHref != "") { window.open(selectedHref, "_self"); } }); } })(window, jQuery); </script> |
免責聲明:本站部分文章和圖片均來自用戶投稿和網絡收集,旨在傳播知識,文章和圖片版權歸原作者及原出處所有,僅供學習與參考,請勿用于商業用途,如果損害了您的權利,請聯系我們及時修正或刪除。謝謝!
始終以前瞻性的眼光聚焦站長、創業、互聯網等領域,為您提供最新最全的互聯網資訊,幫助站長轉型升級,為互聯網創業者提供更加優質的創業信息和品牌營銷服務,與站長一起進步!讓互聯網創業者不再孤獨!
掃一掃,關注站長網微信