如果<a href="test.html">
是在http://test.com?test1这个页面中先用window.location得到当前页面的url
然后从url中取出test2
最后在onload事件中重新设置<a href="">
是在http://test.com?test1这个页面中先用window.location得到当前页面的url
然后从url中取出test2
最后在onload事件中重新设置<a href="">
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><BODY ONLOAD ="changeUrl();">
<div id='sss'><a href='sss'>dsfsf</a></div>
</BODY>
</HTML>
<SCRIPT LANGUAGE="JavaScript">
<!--
function changeUrl()
{
var url = window.location+"";
var pos = url.indexOf("?");
var arg = url.substring(pos+1,url.length);
if(arg=="test")
{
document.all.sss.innerHTML="<a href='test.htm'>test</a>";
}
else
{
document.all.sss.innerHTML="<a href='test2.htm'>test2</a>";
} alert("url="+url+" arg="+arg);
}
//-->
</SCRIPT>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script type="text/javascript">
function aa()
{
var l=window.document.all("lhc");
var sea=window.location.search;
sea=sea.replace(/^\?/,"");
l.href=sea;
}
</script>
</head>
<body onLoad="aa();">
<a href="#" id="lhc">dfasdfasdf </a>
</body>
</html>