保存输入并使用DOM写出来 - JavaScript

时间:2016-12-04 19:13:54

标签: javascript html5 dom input

您好我想将输入从html5页面保存到var输入中 并希望将其显示在另一页上..

在这里你可以看到我的编码。

<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <form method ="post" action="TestJS.html">
            <p>Vorname: <input type="text" id="vorname"></p>
            <p><input value="Send" type="submit"></p>
        </form>
    </body>
</html>

        
   
<html>
    <head>
        <title>Testing of JavaScript - Language</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
<script>
        
        var input = document.getElementById('vorname').value;
        document.write(input);
        
    </script>
        
    </body>
</html>

0 个答案:

没有答案