を追加することはできませんプロパティを読み取ることができません。そのような単純なヌルの「価値」が、私はここで何をすべきさえ window.onload = function(){
ヌルの「の値」プロパティを読み取って、配列内の
後に動作しないことは、私のコードは
window.onload = function(){
var shashank = document.getElementById('shashank').value;
var kiran = document.getElementById('kiran').value;
var sumanth = document.getElementById('sumanth').value;
var arun = document.getElementById('arun').value;
var arr = [shashank,kiran,sumanth,arun];
document.getElementById('btn').addEventListener('click', showName);
}
です
htmlのはこれです:あなたはこのようなのIdsをinlcudeするためにあなたのhtmlを更新する必要が
<html>
<head>
<title>Attendance Sheet</title>
<script src="app.js"></script>
<style>
#present{
width:50px;
height:50px;
}
</style>
</head>
<body>
<select>
<option value="shashank">Shashank</option>
<option value="kiran">Kiran</option>
<option value="sumanth">Sumanth</option>
<option value="arun">Arun</option>
</select>
<button id="present">P</button>
<button id="btn">Submit</button>
</body>
</html>
あなたの要素にはIDがありませんので、明らかに 'document.getElementById'は要素を選択しません。実際にここで何をしようとしていますか? – Turnip