• 两个html页面间传值


    1.html

    <!DOCTYPE html>

    <html>
    <head>
    <meta charset="UTF-8">
    <title>1.html</title>
    </head>
    <body>

    <form action="2.html" name="one" method="get">
    <input type="text" name="one" placeholder="请输入内容">
    <input type="submit" value="Submit" />
    </form>
    </body>
    </html>

    --------------------------------------------------------------------------------------------------------------

    2.html

    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <meta charset="UTF-8">
    </head>
    <body>


    <input id="aaa" style="display:block;200px;height:50px;" type="text">
    <input type="btn" value="提交">
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.js"></script>
    </body>
    <script type="text/javascript" charset="uft-8">

    function getParameter(param)
    {

    var aaa = document.getElementById('aaa');
    var query = decodeURI(window.location.search);//获取当前路径?后的字符串  并解码
    console.log(query);
    var iLen = param.length;//3
    var iStart = query.indexOf(param);//1

    if (iStart == -1)
    return "";
    iStart += iLen + 1;//4
    var va = query.substring(iStart);//截取参数
    aaa.value = va;


    }

    $(document).ready(function () {
    var one = getParameter('one');
    });

    </script>
    </html>

  • 相关阅读:
    Python2.7-math, cmath
    Python2.7-pprint
    Python2.7-copy
    Python2.7-weakref
    Python2.7-Queue
    Python2.7-sched
    Python2.7-array
    Python2.7-bisect
    搜索专题:Balloons
    【洛谷P4460】解锁屏幕【状压dp】
  • 原文地址:https://www.cnblogs.com/gxw123/p/9483009.html
Copyright © 2020-2023  润新知