Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Help with Javascript Variables Concatenation


Message #1 by anne.do@c... on Tue, 24 Sep 2002 14:02:39
I have this javascript used to create a user's email address (First letter 
of firstname + last name + @zbx.com) on the fly once the have inputted 
their first name and last name.  The name of the form is Quick Add.  THe 
script is below but when I execute it I get error: Object does not support 
this property or method.  The email field eventually populates after 
getting the error but it shows undefined for the value Fname[0].  How do I 
put the first letter of a variable correctly?  Can you help?

<SCRIPT LANGUAGE="JavaScript">
<!--
function MakeUser()
{
	var Lname = document.QuickAdd.Last_Name.value
	var Fname = document.QuickAdd.First_Name.value


        var NewEmail = Fname[0] + Lname + "@zbx.com";
	document.QuickAdd.Email.value = NewEmail
	}

//-->
</SCRIPT>


  Return to Index