这里是我的jQuery代码:混合jQuery和ASP.net
$(document).ready(function() {
onfocus();
$(".on_off_checkbox").iphoneStyle();
$('.tip a ').tipsy({gravity: 'sw'});
$('#login').show().animate({ opacity: 1 }, 2000);
$('.logo').show().animate({ opacity: 1,top: '30%'}, 800,function(){
$('.logo').show().delay(1200).animate({ opacity: 1,top: '0%' }, 300,function(){
$('.formLogin').animate({ opacity: 1,left: '0' }, 300);
$('.userbox').animate({ opacity: 0 }, 200).hide();
});
})
});
$('.userload').click(function(e){
$('.formLogin').animate({ opacity: 1,left: '0' }, 300);
$('.userbox').animate({ opacity: 0 }, 200,function(){
$('.userbox').hide();
});
});
$('#but_login').click(function(e){
if($('#username_id').val() == "" || $('#password').val() == "")
{
showError("Please Input Username/Password");
$('.inner').jrumble({ x: 4,y: 0,rotation: 0 });
$('.inner').trigger('startRumble');
setTimeout('$(".inner").trigger("stopRumble")',500);
setTimeout('hideTop()',5000);
return false;
}
hideTop();
loading('Checking',1);
setTimeout("unloading()", 2000);
setTimeout("Login()", 2500);
});
function Login(){
$("#login").animate({ opacity: 1,top: '49%' }, 200,function(){
$('.userbox').show().animate({ opacity: 1 }, 500);
$("#login").animate({ opacity: 0,top: '60%' }, 500,function(){
$(this).fadeOut(200,function(){
$(".text_success").slideDown();
$("#successLogin").animate({opacity: 1,height: "200px"},500);
});
})
})
//setTimeout("window.location.href='dashboard.html'", 3000);
}
$('#alertMessage').click(function(){
hideTop();
});
function showError(str){
$('#alertMessage').addClass('error').html(str).stop(true,true).show().animate({ opacity: 1,right: '0'}, 500);
}
function showSuccess(str){
$('#alertMessage').removeClass('error').html(str).stop(true,true).show().animate({ opacity: 1,right: '0'}, 500);
}
function onfocus(){
if($(window).width()>480) {
$('.tip input').tipsy({ trigger: 'focus', gravity: 'w' ,live: true});
}else{
$('.tip input').tipsy("hide");
}
}
function hideTop(){
$('#alertMessage').animate({ opacity: 0,right: '-20'}, 500,function(){ $(this).hide(); });
}
function loading(name,overlay) {
$('body').append('<div id="overlay"></div><div id="preloader">'+name+'..</div>');
if(overlay==1){
$('#overlay').css('opacity',0.1).fadeIn(function(){ $('#preloader').fadeIn(); });
return false;
}
$('#preloader').fadeIn();
}
function unloading() {
$('#preloader').fadeOut('fast',function(){ $('#overlay').fadeOut(); });
}
这里是我的ASP.net代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
这里是HTML:
<div class="formLogin">
<div class="tip">
<input name="username" type="text" id="username_id" title="Username" />
</div>
<div class="tip">
<input name="password" type="password" id="password" title="Password" />
</div>
<div class="loginButton">
<div style="float:left; margin-left:-9px;">
<input type="checkbox" id="on_off" name="remember" class="on_off_checkbox" value="1" />
<span class="f_help">Remember me</span>
</div>
<div style="float:right; padding:3px 0; margin-right:-12px;">
<div>
<ul class="uibutton-group">
<li><a class="uibutton normal" href="#" id="but_login" >Login</a></li>
<li><a class="uibutton normal" href="#" id="forgetpass">forgetpass</a></li>
</ul>
</div>
</div>
<div class="clear"></div>
</div>
</div>
我我对ASP.net非常陌生,我有客户端验证工作,以确保用户名或密码不是空白。我无能为力的是如何在服务器端进行验证。
我来自经典asp的强大背景,并且正在向ASP.net迈进。我知道像我需要检查用户名和密码是否为空的基本知识,如果它们返回错误。
我需要在我的but_login上使用runat = server吗?我如何附加一些后端asp.net代码,所以当它链接它点击它处理服务器代码?
在此先感谢。
不是一个选项,因为这是一个模板来加快网站设计的过程。我只会重写为最后的手段。 =( – 2012-04-12 20:11:50
@JamesWilson根据您的评论更新了我的答案 – Jeff 2012-04-12 20:26:35