<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> function GetUrlParam(paramName) { var url = document.URL; //URL参数,你也可以用document.URL来获取,方法太多了 var oRegex = new RegExp('[\?&]' + paramName + '=([^&]+)', 'i'); //var oMatch = oRegex.exec( window.top.location.search ) ; //获取当前窗口的URL var oMatch = oRegex.exec(url); if (oMatch && oMatch.length > 1) return oMatch[1]; //返回值 else return ''; } </script> </head> <body> <div id="a"> </div> <div id="b"> </div> <script type="text/javascript"> $("#a").html(GetUrlParam("id")); $("#b").html(GetUrlParam("name")); </script> <!--例如 url?id=1234&name=12441--> </body> </html>