View Full Version : Problems with getElementByID

02-15-2007, 09:43 AM
I have made a system to add names to a list. I have 3 input text fields, and I gave them all a unique ID. But I can't manage to reach them with getElementByID. Could someone look into my code and tell me what I am doing wrong?

//this is the part were I made the input fields and there ID's//

<input type="Text" id="input" />
<input type="Text" id="search" />
<input type="Text" id="result" onFocus="blur()" />
//this is were I use the getElent to reach the textfields by ID//

var inputField = document.getElementById('input');
var searchField = document.getElementById('search');
var resultField = document.getElementById('result');
//this is how i've put it in the code//

function addName() {
if (inputField.value != '') {
} //addName

function searchArray() {
gevonden = 'nee';
for (j = 0; gevonden == 'nee' && j < namen.length; j++) {
if (namen[j] == searchField.value) {
gevonden = 'ja';
resultField.value = j;
else {
resultField.value = 'niet gevonden';


Thank you in advance!


02-15-2007, 03:59 PM
before this line:




does it show [object] or something like that, if it does then the problem is .value . Specify the error returned next time.


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum