日期:2014-05-17 浏览次数:20759 次
<html> <head> <title> 这是父页面 </title> <script type="text/javascript"> function createNewWindow(){ var args=new Array("美女","房子","汽车"); var url="children.html?args1="+args[0]+"&args2="+args[1]+"&args3="+args[2]; var iHeight=100; var iWidth=400; var iTop=(window.screen.availHeight-30-iHeight)/2; var iLeft=(window.screen.availWidth-10-iWidth)/2; window.open(url,"childrenWindow","height="+iHeight+",width="+iWidth+",top="+iTop+",left="+iLeft+",toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no"); } </script> </head> <body> <input type="button" value="点击测试" onclick="createNewWindow()"> </body> </html>
<html> <head> <title> 这是子页面 </title> </head> <body> <div id="resultDiv" name="resultDiv"></div> </body> <script type="text/javascript"> var urlInfo=window.location.href; var argsIndex=urlInfo.indexOf("?"); var args=urlInfo.substring((argsIndex+1)).split("&"); var argsInfo=""; for(i=0;i<args.length;i++){ var argResult=args[i].split("="); if(argResult.length==2){ argsInfo+="参数名["+argResult[0]+"]"; argsInfo+="参数值["+argResult[1]+"]"; argsInfo+="<br/>"; } } document.getElementById("resultDiv").innerHTML=argsInfo; </script> </html>