if(!(window.jQuery)) { var s = document.createElement('script'); s.setAttribute('src', '//apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js'); s.setAttribute('type', 'text/javascript'); document.getElementsByTagName('head')[0].appendChild(s); } if(window.addEventListener){ window.addEventListener("load",jhcdiy1,false); }else{ window.attachEvent("onload",jhcdiy1); } function jhcdiy1(){ $(function(){ $("input[name=daikuan1]").on("click",function(){ var jhcmd=$('#model1').html(); jhcmd=jhcmd.replace(/M[0-9]+M/,'M')+$(this).val(); $('#model1').html(jhcmd); $("#price1").html($(this).attr("data-price")); $("#url1").attr('href',$(this).attr("data-url")); }); $("input[name=daikuan2]").on("click",function(){ var jhcmd=$('#model2').html(); jhcmd=jhcmd.replace(/G[0-9]+M/,'G')+$(this).val(); $('#model2').html(jhcmd); $("#price2").html($(this).attr("data-price")); $("#url2").attr('href',$(this).attr("data-url")); }); $("input[name=daikuan3]").on("click",function(){ var jhcmd=$('#model3').html(); jhcmd=jhcmd.replace(/G[0-9]+M/,'G')+$(this).val(); $('#model3').html(jhcmd); $("#price3").html($(this).attr("data-price")); $("#url3").attr('href',$(this).attr("data-url")); }); $("input[name=daikuan4]").on("click",function(){ var jhcmd=$('#model4').html(); jhcmd=jhcmd.replace(/G[0-9]+M/,'G')+$(this).val(); $('#model4').html(jhcmd); $("#price4").html($(this).attr("data-price")); $("#url4").attr('href',$(this).attr("data-url")); }); }); }
动态加载:
$("<link>").attr({ rel:"stylesheet",type:"text/css",href:"/e/extend/jhcMoveMenu/jhc.css"}).appendTo("head");