日期:2014-05-16 浏览次数:20500 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script type="text/javascript" src="jquery-1.6.4.min.js" ></script>
<form id="form1" action="savenote.asp" method="post" onsubmit="return checklogin();" >
<textarea rows="10" cols="100" name="note" ></textarea>
<input type="submit" value="保存发言" />
</form>
<script type="text/javascript" >
function checklogin() {
jQuery.ajax({
url: 'checklogin.asp?' + Math.random(),
success: function(result) {
alert(result);
if (result == "1") {
alert("你已经登录,可以继续提交");
document.getElementById("form1").submit();
} else {
alert("你没有登录,请登录");
$("#login").show();
}
},
async: false
});
return false;
}
</script>
<div id="login" style="display:none;">
用户名<input />
密码:<input />
<input type="button" value="登录" />
</div>
</body>
</html>