原生js实现url传参,以及获取url参数

A页面
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
    <form action="11.htm">
      <input type="text" name="young">
      <input type="submit">
    </form>
</body>
</html>
<script>
</script>
B页面
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
        <div>
      
        </div>
       
</body>
</html>
<script>
    var query = location.search
    var div = document.querySelector('div')
   var a = query.substr(1)
    console.log(a);
    var arr = a.split('=')
    console.log(arr);
    div.innerHTML = '欢迎'+  arr[1]

</script>
上一篇:AJ-Report项目分析(12)


下一篇:word文档的图片怎么保存到wordpress上