0
請幫助我,我對所有這些都比較陌生,我只是想知道如何才能將這些數據提交給我的簡單JavaScript文件,然後執行一些命令。那就是:向我展示的代碼,而不是實際運行它
<html>
<head>
<center><h1>Test-Page</h1></center>
<title>Hardware Compare</title>
</head>
<body>
<script src="text/javascript">
function updateInput() {
var userIDInput = document.getElementById('userID');
var submittedInput = userIDInput.value;
document.getElementById('testingID').innerHTML='submittedInput'
}
</script>
<div class="testing">
<h2 id="testingID">Sign In</h2>
<form name="input" action="login.js" method="POST">
Username: <input type="text" name="userID" />
Password: <input type="password" name="password" />
<input type="submit" value="Submit" name="sub" />
</form>
</div>
</body>
,這裏是JavaScript代碼:
function updateInput() {
var userIDInput = document.getElementsByName("UserID")[0].value;
var submittedInput = userIDInput.value;
document.getElementById('testingID').innerHTML=submittedInput
}
的roblem是,在提交時,網頁瀏覽器顯示實際的代碼,而不是運行它:/這讓我困擾了一段時間,我似乎無法修復它。這可能是一些常見的noob錯誤,但我真的很感謝一些幫助,歡呼!
太棒了!謝謝:) – HazzaMcJazza
不客氣,很高興幫助! – dfsq