나는 이것이 세상에서 가장 쉬운 일이라고 생각합니다. 난 그냥 onclick 전화 버튼을 만들고 자바 스크립트를 실행하고 싶습니다. 그러나 내가 할 때마다 잡히지 않은 TypeError : undefined가 함수가 아닙니다 오류.버튼 onclick 정의되지 않은 함수가 아닙니다.
나는 이것을 읽었지만 그 기능을 찾을 수없는 이유를 이해하지 못하는 것 같습니다.
요약 : 버튼을 누르면 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>
어떤 생각이? 당신의 도움에 미리 감사드립니다!
javascript에는 getElementByID라는 것이 아무것도 없습니다. 'getElementById', NOT'초 getElementByID' : :''하지''(자기 닫는 태그), 셋째 : 그냥
'같은'
'(자기 폐쇄를 당신은'getElementById.' –
첫째을 사용하는 가정된다 '), 넷째 :'' 태그를 다룰 때 label 태그를 사용해야합니다; 자세한 내용은 http://www.w3schools.com/tags/tag_label.asp -> "