Atl*_*rth 1 html javascript onclick button
我觉得这应该是世界上最简单的事情.我只想制作一个带有onclick调用的按钮,让它运行javascript.然而,每次我这样做,我得到Uncaught TypeError:undefined不是函数错误.
我已经阅读了这个,但似乎不明白为什么它找不到这个功能.
回顾一下:按下按钮应该运行ThePush()但是我在控制台上出错了.
码:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function ThePush() {
var name = document.getElementByID('name').value;
var pl = document.getElementByID('PL1').value;
var plw = document.getElementByID('theplw').value;
var al = document.getElementByID('theal').value;
//do stuff with these variables.
}
</script>
</head>
<body>
<b>Player One: </b><input id="name" type="text" value="Name"></input>
<br/><b>Level: </b><input id="PL1" style="width:50px" type="text" id="PL1L" value="0" readonly></input>
<br/>
<button id="thesub" onclick="ThePush();">Submit</button>
<select id="theplw">
<option value="A: 0-999">A: 0-999</option>
<option value="B: 1,000-9,999">B: 1,000-9,999</option>
<option value="C: 10,000-99,999">C: 10,000-99,999</option>
<option value="D: 100,000-499,999">D: 100,000-499,999</option>
<option value="E: 500,000-1,499,999">E: 500,000-1,499,999</option>
<option value="F: 1,500,000+">F: 1,500,000+</option></select>
<br/><b>Sub Level: </b><input id="theal" style="width:50px" type="text" id="AL1L" value="0" readonly></input>
<hr>
<iframe src="others.php" frameborder="0" width="500"></iframe>
<iframe id="updater" src="update.php" frameborder="0" width="0" height="0"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?预先感谢您的帮助!