...

View Full Version : I'm a newbie...please!"



jpinto
07-10-2003, 11:21 PM
Why this code won't work? I get an error on the .forms[0]

function avanza(next){
if (event.keyCode == "9" ||event.keyCode == "16" || event.shiftKey ){
return false;
}
else
{
if ( event.srcElement.value.length == event.srcElement.maxLength ) {
document.forms[0][next].focus();
}
}
}

Thanks.

Roy Sinclair
07-10-2003, 11:27 PM
Maybe you're missing some things:

document.forms[0].elements["next"].focus();


Please click on the "Posting Guidelines: Read This Before You Post" link, there's good information there you obviously missed.

cheesebagpipe
07-10-2003, 11:55 PM
If next is an integer (form element index), document.forms[0][next] should return an element reference correctly; the elements[] object isn't required. Without the calling HTML, don't think the problem can be analyzed properly.

jpinto
07-11-2003, 12:07 AM
Thanks cheesebagpipe. The problem was really on the HTML code.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum