...

View Full Version : What am I doing wrong here?



bbotts
07-03-2004, 07:44 PM
When I get to the point where this code should execute, I get an "Object expected" error message. Here's the code.



function generateUsername(){
if(document.register.loginUsername.value==""){
document.register.loginUsername.value =
substring(document.register.firstName.value, 0, 1) +
substring(document.register.lastName.value, 0, 5) +
substring(document.register.birthDate.value, -2, 2);
}
}

Mr J
07-03-2004, 08:22 PM
I think it should be something like this

function generateUsername(){
if(document.register.loginUsername.value==""){
document.register.loginUsername.value =
document.register.firstName.value.substring(0, 1) +
document.register.lastName.value.substring(0, 5) +
document.register.birthDate.value.substring(-2, 2);
}
}

bbotts
07-03-2004, 08:31 PM
That works. I was thinking in PHP when I was writing it. :)
I feel silly now.

Thanks a lot.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum