要更新的頁面
復制代碼 代碼如下:
<!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>
<script src="js/jquery.js" type="text/javascript"></script>
</head>
<body>
<select onchange="return duoduo();">
<option value="1">第一期</option>
<option value="2">第二期</option>
</select>
<div>
你好</div>
<input type="text" />
</body>
<script type="text/javascript">
function duoduo() {
$.ajax({
type: 'post', //可選get
url: 'ajax.aspx', //這里是接收數據的程序
data: 'data=' + $("#lucky1").val(), //傳給PHP的數據,多個參數用&連接
dataType: 'html', //服務器返回的數據類型 可選XML ,Json jsonp script html text等
success: function(msg) {
//這里是ajax提交成功后,程序返回的數據處理函數。msg是返回的數據,數據類型在dataType參數里定義!
document.getElementByIdx_x_x("duoduo").innerHTML = msg;
//$("#duoduo").innerHTML = msg;
},
error: function() {
alert('對不起失敗了');
}
})
}
</script>
</html>
復制代碼 代碼如下:
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Params["data"].ToString().Equals("1"))
{
Response.Write("<a href=/"http://www.baidu.com/">第一期</a>");
}
else if (Request.Params["data"].ToString().Equals("2"))
{
Response.Write("<a href=/"http://www.baidu.com/">第2期</a>");
}
}
新聞熱點
疑難解答
圖片精選