function swithimg(s) { $('#q').attr({'ds':s}).val(s).css({'color':'#A1A1A1'}); $("#imgflag").val(1); $("#aresch").hide(); $('#tflag').show(); } function swithselect(s) { $('#q').attr({'ds':s}).val(s).css({'color':'#A1A1A1'}); $("#imgflag").val(0); $("#aresch").show(); $('#tflag').hide(); } $().ready(function(){ $("#addres").val(window.location.href) var content=window.location.href; $('#icform').submit(function(){ var obj = $(':radio[name="searchtype"]:checked'); var __l = $.trim($('#q').val()).replace(/[\u4e00-\u9fa5]/g,'aa').length; var __a; //alert($('#q').attr('ds') + '||'+$('#q').val()) //alert(obj.attr('vl')); if(($('#q').val()==$('#q').attr('ds') && obj.attr('vl')>0) || (__l < obj.attr('vl') && obj.attr('vl')>0)){ __a = (obj.attr('al')).replace(/(%s)/g, (obj.attr('vl')-1)+''); alert(__a); return false; }else if($(':radio[name="searchtype"]:checked').val() == 2){ var q = encode64($('#q').val()); location.href = $('#icform').attr('action') + '&term.q=' + q + '&term.area=' + $('#aresch').val(); return false; } }); $('#q').click(function(){ if($(this).val()==$(this).attr('ds')) $(this).val('').css({'color':'#000'}); }); $('#tflag').change(function(){ var obj = $(':radio[name="searchtype"][value="3"]'); if($(this).val()==1){ obj.attr({'vl':3, 'al':'非IC搜索时,输入必须大于%s个字符!'}); $('#icform').attr({'action':'http://www.cecb2b.com/search/qnicimg.do'}); }else{ obj.attr({'vl':4, 'al':'IC搜索时,输入必须大于%s个字符!'}); $('#icform').attr({'action':'http://www.cecb2b.com/search/qicimg.do'}); } }); $(':radio[name="searchtype"]').click(function(){ $('#icform').attr({'action':$(this).attr('act')}); }); }); function copyadd(){ var content = window.location.href; if(navigator.userAgent.toLowerCase().indexOf('ie') > -1) { clipboardData.setData('Text',content); alert ("复制成功,现在您可以ctrl+v粘贴到word或者聊天工具对话框中"); } else { prompt("您使用的浏览器不支持此功能,请使用Ctrl+C或点击鼠标右键进行复制",content); } $('#copyAddCell').hide(); } function fiximage() { var max=600; imgs = document.getElementsByTagName('img'); for(i=0;imax) { imgs[i].width=max;imgs[i].height=h/(w/max);} } } function addBookmark(title,url) { if (window.sidebar) { window.sidebar.addPanel(''+title, ''+url,""); } else if( document.all ) { window.external.AddFavorite(''+url, ''+title); } else if( window.opera && window.print ) { return true; } } function changeTabs(n){ $("#tab"+n).addClass("sel"); } function classOpen(n){ if($("img",$("#Class_"+n)).attr("src").indexOf("_-")!=-1) { $("img",$("#Class_"+n)).attr("src","../../images/shop/new_shop_2010/icon_+.jpg"); } else { $("img",$("#Class_"+n)).attr("src","../../images/shop/new_shop_2010/icon_-.jpg"); } $('[id^=Class_'+n+'_]').toggle(); } $(document).ready(function(){ $('.search_radio').click(function(){ if($(this)[0].id=='search_ic'){ $('form#frm_searchLeft').attr({ action:shop_site+'?id=33&menuindex=17&stype=search' }) }else{ $('form#frm_searchLeft').attr({ action:shop_site+'?id=33&menuindex=12&stype=search' }) } }); $('form#frm_searchLeft').submit(function(){ var __l = $.trim($('#q', $('#frm_searchLeft')).val()).replace(/[\u4e00-\u9fa5]/g,'aa').length; if($('#search_ic')[0].checked && __l<4){ alert('输入搜索内容不得小于4个字符。'); return false; }else if($('#search_nic')[0].checked && __l<3){ alert('输入搜索内容不得小于3个字符。'); return false; } }); $('.btn_search').click(function(){ var d = (typeof $('demand').val() != "undefined") ? $('demand').val() : 0; $('#frm_corp_search').attr({'action':shop_site+'?id=33&menuindex=7&demand='+d}) $('#frm_corp_search').submit(); }); $('#srch_type').change(function(){ if($(this).val()==1){ $('#q').val('请输入您要查找的IC型号').css({'color':'#A1A1A1'}); }else{ $('#q').val('请输入您要查找的产品名称或型号').css({'color':'#A1A1A1'}); } }); $('#q').focus(function(){ if($(this).val()=='请输入您要查找的IC型号' && $('#srch_type').val()==1){ $('#q').val('').css({'color':'#000'}); }else if($(this).val()=='请输入您要查找的产品名称或型号' && $('#srch_type').val()==2){ $('#q').val('').css({'color':'#000'}); } }); $('form[name="frm_corp_search"]').submit(function(){ var v = $('#q', $(this)).val() || ""; var vl = v.replace(/[\u4e00-\u9fa5]/g,"aa").length; if($('#srch_type').val()==1 && $('#q').val() == '请输入您要查找的IC型号'){ alert('请输入您要查找的产品!'); return false; }else if($('#srch_type').val()==2 && $('#q').val() == '请输入您要查找的产品名称或型号'){ alert('请输入您要查找的产品!'); return false; }else if(vl<1){ alert('请输入您要查找的产品!'); return false; }else if(vl<2 && $('#srch_type').val()==2){ alert('请输入至少2个字符!'); return false; }else if(vl<4 && $('#srch_type').val()==1){ alert('请输入至少4个字符!'); return false; } }); }); function showloginpop(str){ var browserName=navigator.userAgent.toLowerCase(); $("body").append("
"+ "
"+ "

"+ ""+ "我要投票

"+ "
") $("#bgloginpop").show() $("#bgloginpop").width($("body").width()) $("#bgloginpop").height($("body").height()) if(/chrome/i.test(browserName) && /webkit/i.test(browserName) && /mozilla/i.test(browserName)){ $("#loginpop").css({"top":(document.documentElement.clientHeight-$("#loginpop").height())/2+document.body.scrollTop,"left":($("body").width()/2-$("#loginpop").width()/2)+"px"}) } else { $("#loginpop").css({"top":(document.documentElement.clientHeight-$("#loginpop").height())/2+document.documentElement.scrollTop,"left":($("body").width()/2-$("#loginpop").width()/2)+"px"}) } } function closeloginpop(){ $("#loginpop").remove(); if(typeof s=='undefined') $('#bgloginpop').hide(); } function closeloginpop2(){ $("#loginpop").remove(); if(typeof s=='undefined') $('#bgloginpop').show(); } function showcjpop(s, sjt){ if(sjt) str = '商机通400 626 5285,邀请好友,返20分钟'; else str = '商机通400 626 5285,详情查看'; var browserName=navigator.userAgent.toLowerCase(); if(s == 3){ $('#cjpoptext').html('您今天已对此公司投过票,感谢您的参与!
' + str); $('#cjpopvote').hide(); } else if(s == 2){ $('#cjpoptext').html('投票成功,感谢您的参与!
' + str); $('#cjpopvote').hide(); }else if(s == 1){ $('#cjpoptext').html('投票成功,感谢您的参与!
' + str); $('#cjpopvote').show(); } else { $('#cjpoptext').html('您好!您的账号还未通过审核,
详情请联系400 626 5285 转618,
' + str); $('#cjpopvote').hide(); } $("#startcj").show(); $("#bgloginpop").show(); $("#bgloginpop").width($("body").width()) $("#bgloginpop").height($("body").height()) if(/chrome/i.test(browserName) && /webkit/i.test(browserName) && /mozilla/i.test(browserName)){ $("#startcj").css({"top":(document.documentElement.clientHeight-$("#startcj").height())/2+document.body.scrollTop,"left":($("body").width()/2-$("#startcj").width()/2)+"px"}) } else { $("#startcj").css({"top":(document.documentElement.clientHeight-$("#startcj").height())/2+document.documentElement.scrollTop,"left":($("body").width()/2-$("#startcj").width()/2)+"px"}) } } function closecjpop(s){ $("#startcj").hide(); $('#bgloginpop').hide(); location.reload(); } function clear(v){ $("#bgblack").remove(); $("#popwindow").remove(); if(v==1){ $('#btn_search').focus().select(); } } $(function(){ $('#btn_startv').click(function(){ $.get('/zt/pingxuan.php?action=login&mod=qiang&'+Math.random()*1000,function(ret){ ret = $.trim(ret); if(ret){ alert('恭喜您,中了'+ret+',\n抽奖所得奖品客服人员将于每周五统一为您发放,\n敬请期待!'); }else{ alert('谢谢您的参与,明天继续努力吧,大奖等您拿哦!'); } closecjpop(); }); }); }); function closeyqpop() { location.reload(); } function showsjt() { var url = '/member/adPhoneInvite.do'; $("#startcj").hide(); $("body").append(""); }