-1
我在jquery和ajax中執行了一個代碼,在Safari,FF和IE8中工作得很好,但在IE6中不工作。jquery IE6 IE7隱藏和顯示錯誤
他可以5組窗體可編輯,不應該顯示,但只有第一個作品,ajax也不能在IE6和IE7中工作。
閃爍只能放入2,但是5你怎麼看到下面的鏈接。
$(document).ready(function(){
var n=1;
$forms = $('#MemberCont'+n+' form');
$('#MemberCont'+n+' #toogle').hide();
$('#MemberCont'+n+' #hide').hide();
$('#MemberCont'+n+' a').bind('click', function(){
switch(this.id){
case 'c':
$('#MemberCont'+n+' #change').hide();
$('#MemberCont'+n+' #phone').hide();
$('#MemberCont'+n+' #hide').show();
$('#MemberCont'+n+' #toogle').show();
return false;
break;
case 'd':
$('#MemberCont'+n+' #change').show();
$('#MemberCont'+n+' #phone').show();
$('#MemberCont'+n+' #hide').hide();
$('#MemberCont'+n+' #toogle').hide();
return false;
break;
}
})
$forms.bind('submit', function(){
var $button = $('#MemberCont'+n+' button',this).attr('disabled',true);
var params = $(this.elements).serialize();
var self = this;
$.ajax({
type: 'POST',
url: this.action,
data: params,
beforeSend: function(){
$('#MemberCont'+n+' #phone').show();
$('#MemberCont'+n+' #hide').hide();
$('#MemberCont'+n+' #phone').html("Loading...");
},
success: function(txt){
$('#MemberCont'+n+' #top').show();
$('#MemberCont'+n+' #cadastro').hide();
$('#MemberCont'+n+' #hide').hide();
$('#MemberCont'+n+' #toogle').hide();
$('#MemberCont'+n+' #change').show();
$button.attr('disabled',false);
$('#MemberCont'+n+' #phone').html(txt);
self.reset();
},
error: function(txt){
$('#MemberCont'+n+' #phone').html(txt);
}
})
return false;
});
});
$(document).ready(function(){
var n=2;
$forms = $('#MemberCont'+n+' form');
$('#MemberCont'+n+' #toogle').hide();
$('#MemberCont'+n+' #hide').hide();
$('#MemberCont'+n+' a').bind('click', function(){
switch(this.id){
case 'c':
$('#MemberCont'+n+' #change').hide();
$('#MemberCont'+n+' #phone').hide();
$('#MemberCont'+n+' #hide').show();
$('#MemberCont'+n+' #toogle').show();
return false;
break;
case 'd':
$('#MemberCont'+n+' #change').show();
$('#MemberCont'+n+' #phone').show();
$('#MemberCont'+n+' #hide').hide();
$('#MemberCont'+n+' #toogle').hide();
return false;
break;
}
})
$forms.bind('submit', function(){
var $button = $('#MemberCont'+n+' button',this).attr('disabled',true);
var params = $(this.elements).serialize();
var self = this;
$.ajax({
type: 'POST',
url: this.action,
data: params,
beforeSend: function(){
$('#MemberCont'+n+' #phone').show();
$('#MemberCont'+n+' #hide').hide();
$('#MemberCont'+n+' #phone').html("Loading...");
},
success: function(txt){
$('#MemberCont'+n+' #top').show();
$('#MemberCont'+n+' #cadastro').hide();
$('#MemberCont'+n+' #hide').hide();
$('#MemberCont'+n+' #toogle').hide();
$('#MemberCont'+n+' #change').show();
$button.attr('disabled',false);
$('#MemberCont'+n+' #phone').html(txt);
self.reset();
},
error: function(txt){
$('#MemberCont'+n+' #phone').html(txt);
}
})
return false;
});
});
HTML:
<div id="MemberCont1" style="float:left; display:block; margin: 15px 30px 10px 30px; width: 563px;">
<div id="ResultTitle" style="width:217px;">Business Name</div>
<div id="MemberPhone" style="width:340px;"><div id="hide"><a href="" id="d"><img src="../img/hide_btn.gif" width="65" height="25" alt="Hide" /></a></div><div id="phone"><?php echo $result['business']; ?></div></div>
<hr class="Line" />
<div id="toogle" style="font-size:12px; color:#FFF; ">
<div id="none" style="position:relative; float:left; display:inline; padding-bottom:2px;">Change business name</div>
<form action="personal_update.php" style="clear:left; margin:0 0 10px 0;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="dataform" type="text" class="FormMember" id="dataform" />
<input name="id_member" type="hidden" value="<?php echo $result['id_member']; ?>" />
<input name="table" type="hidden" value="business" /></td>
<td align="right"><input name="submit" type="image" value="submit" src="../img/submit_member.gif" /></td>
</tr>
</table>
</form>
</div><!--toogle-->
<div id="change"><a href="" id="c"><img src="../img/change_btn.gif" alt="Change" width="64" height="25" align="left" /></a></div>
</div><!--/*MemberCont*/-->
<div id="MemberCont2" style="float:left; display:block; margin: 15px 30px 10px 30px; width: 563px;">
<div id="ResultTitle" style="width:217px;">Contact Name</div>
<div id="MemberPhone" style="width:340px;"><div id="hide"><a href="" id="d"><img src="../img/hide_btn.gif" width="65" height="25" alt="Hide" /></a></div><div id="phone"><?php echo $result['contact']; ?></div></div>
<hr class="Line" />
<div id="toogle" style="font-size:12px; color:#FFF; ">
<div id="none" style="position:relative; float:left; display:inline; padding-bottom:2px;">Change contact name</div>
<form action="personal_update.php" style="clear:left; margin:0 0 10px 0;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="dataform" type="text" class="FormMember" id="dataform" />
<input name="id_member" type="hidden" value="<?php echo $result['id_member']; ?>" />
<input name="table" type="hidden" value="contact" /></td>
<td align="right"><input name="submit" type="image" value="submit" src="../img/submit_member.gif" /></td>
</tr>
</table>
</form>
</div><!--toogle-->
<div id="change"><a href="" id="c"><img src="../img/change_btn.gif" alt="Change" width="64" height="25" align="left" /></a></div>
</div><!--/*MemberCont*/-->
你能否詳細說明* *什麼是不工作,因爲它應該在IE6? – 2009-09-14 19:47:22
@Mango:請將您的代碼示例修剪到不能正常工作的區域,並提供IE 6中此代碼的具體錯誤。 – 2009-09-14 19:47:59
儘量說明問題,如前所述,不清楚哪些功能無效。 – tomdemuyt 2009-09-18 18:44:28