這個問題困擾了很久,以爲 觸發什麼事件,但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) {