<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>

 

相关文章:

  • 2022-12-23
  • 2021-04-29
  • 2021-12-27
  • 2022-12-23
  • 2021-06-22
  • 2022-01-22
  • 2021-11-23
猜你喜欢
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案