我有一個帶登錄/註冊表單的模式窗口。我想在提交兩種表單之一後阻止模式窗口消失。任何ideea我該怎麼做?在表單提交後使模態窗口持續存在
這裏是我的jQuery代碼:
$(document).ready(function(){
$('#pop2').click(function(){
var width=$(window).width();
width = (width/2)-350;
$('.popup2').css('left',width+'px');
var height=$(window).height();
$('.popup2').css('top',(height/2)-(($('.popup2').height())/2)+'px');
$('.trbg1').fadeIn('fast',function(){
$('.popup2').fadeIn();
});
});
$('.closep2').click(function(){
$('.popup2').fadeOut('fast',function(){
$('.trbg1').fadeOut();
});
});
});
這是我的HTML代碼:
<div class="trbg1" style="display:none"></div>
<div class="popup2" style="display:none">
<div class="ppad2">
<a href="#" class="closep2"></a>
<div class="clear"></div>
<div class="popleft m4">
<span>Sunt deja client:</span>
<form method="post" action="">
<label class="label1">E-mail:</label>
<input type="text" class="inp1" id="lemail" />
<label class="label1">Parola:</label>
<input type="text" class="inp1" id="lparola"/>
<input class="login" type="submit" value="Login"/>
</form>
</div>
<div class="popleft">
<span>Sunt client nou:</span>
<form method="post" action="">
<label class="label1">Nume:</label>
<input type="text" class="inp1" id="nume" />
<label class="label1">Prenume:</label>
<input type="text" class="inp1" id="prenume"/>
<label class="label1">E-mail:</label>
<input type="text" class="inp1" id="iemail"/>
<label class="label1">Parola:</label>
<input type="text" class="inp1" id="iparola1"/>
<label class="label1">Reintrodu parola:</label>
<input type="text" class="inp1" id="liparola2"/>
<div class="m5">
<input type="checkbox" style="float:left;" /> <label class="label2">I agree to the Membership Agreement.*</label>
</div>
<div class="m5">
<input type="checkbox" style="float:left;" /> <label class="label2">Doresc sa primesc newsletter-ul periodic cu noutatile si campaniile exclusive icut.ro</label>
</div>
<br class="clear" />
<input class="inreg" type="submit" value="Inregistrare"/>
</form>
</div>
<div class="clear"></div>
</div>
</div>
謝謝。你
你應該使用:ajax http://api.jquery.com/jQuery.ajax/提交表格! – 2010-09-19 16:12:04