你好,我想從一個HTML5頁面我的輸入保存到一個變種輸入 ,並希望以顯示它的另一頁上..保存輸入並與DOM寫出來 - JavaScript的
在這裏你可以看到我的編碼。
<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>
JavaScript不能訪問發佈的值。使用get或localStorage()。 – Lain