日期:2014-05-16 浏览次数:20817 次
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script>
function mc(obj){
var obj=$(obj).text();
$.ajax({
type: "get",
url:"test.cgi?name="+obj,
async: true,
timeout: 15000,
beforeSend: function(xhr) {
xhr.setRequestHeader("If-Modified-Since", "0");
},
success: function(xmlDoc, textStatus, xhr)
{
if(xhr.readyState==4)
{
if(xhr.status == 200)
{
alert(obj)
window.location.href = "b.htm";
}
}
}
});
}
</script>
</head>
<body>
<ul>
<li><a href='javascript:void(0);' onclick='mc(this)'>名称一</a></li>
<li><a href='javascript:void(0);' onclick='mc(this)'>名称二</a></li>
<li><a href='javascript:void(0);' onclick='mc(this)'>名称三</a></li>
</ul>
</body>
</html>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(function(){
$.ajax({
type: "get",
url:"test.cgi?name="+obj, //这边的obj从a.htm点击后得到
async: true,
timeout: 15000,
beforeSend: function(xhr) { //beforeSend定义全局变量
xhr.setRequestHeader("If-Modified-Since", "0"); //If-Modified-Since HTTP请求头标签,即比较浏览器缓存页面时间
},
success: function(xmlDoc, textStatus, xhr)
{
if(xhr.readyState==4)
{
if(xhr.status == 200)
{
alert(xhr.responseText)
}
}
},
});
});
</script>
</head>
<body>
</body>
</html>
url:"test.cgi?name="+'<%=Request.QueryString["name"]%>',