I have the following code:
I am trying to get the value entered into the firstname box appear on an alert box when the send button is pressed.Code:<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT"> <!-- function post45 () { alert(+ myForm.firstname.value +); document.bgColor="#EEEEEE"; } //--> </SCRIPT> <form name="myForm"> <table border="0"> <tr> <td><label for="firstname">Firstname:</label></td> <td><input type="text" name="firstname" id="firstname"></td> </tr> <tr> <td></td> <td><input type="button" value="Close" onclick="closeMessage()"> <input type="button" value="Send" onclick="post45(myForm)"></td> </tr> </table> <script type="text/javascript"> document.myForm.firstname.focus(); </script> </form>
With the above code the alert box dosnt display but if i take away the + myForm.firstname.value + from the java script it displays the alert box.
Could someone please sugest a way i can get the + myForm.firstname.value + to display the entered value ?


Reply With Quote
Bookmarks