DWZ select combox 級聯中遇到的一個bug

bug重現:
每次我登錄 系統時,第一次 選擇級聯菜單時,比如選擇 山東省, 他就會報tajax error錯 跳轉到首頁。 而再次重新選擇級聯菜單時,  再選擇山東省,就會 在下一級輸出 濟南、青島等市一級。

這個問題困擾了很久,以爲 觸發什麼事件,但js水平不高,排了好幾次,都這樣。昨晚上 無聊 又排了下 。發現 是因爲 <a href='http://gaoce19871026.blog.163.com/#' ></a>  這裏的問題,所幸  把下面標紅色的 # ,改爲 javascript:void(0);,就ok了
return this.each(function(i){
    var $this = $(this).removeClass("combox");
    var name = $this.attr("name");
    var value= $this.val();
    var label = $("option[value=" + value + "]",$this).text();
    var ref = $this.attr("ref");
    var refUrl = $this.attr("refUrl") || "";

    var cid = $this.attr("id") || Math.round(Math.random()*10000000);
    var select = '<div class="combox"><div id="combox_'+ cid +'" class="select"' + (ref?' ref="' + ref + '"' : '') + '>';
    select += '<a href="javascript:" class="'+$this.attr("class")+'" name="' + name +'" value="' + value + '">' + label +'</a></div></div>';
    var options = '<ul class="comboxop" id="op_combox_'+ cid +'">';
    $("option", $this).each(function(){
        var option = $(this);
        options +="<li><a class=\""+ (value==option[0].value?"selected":"") +"\" href=\"#\" value=\"" + option[0].value + "\">" + option[0].text + "</a></li>";
    });
    options +="</ul>";
   
    $("body").append(options);
    $this.after(select);
    $("div.select", $this.next()).comboxSelect().append($this);
   
    if (ref && refUrl) {
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章