How to pass the content of input="text" to a javascript function ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mickey0
    New Member
    • Jan 2008
    • 142

    How to pass the content of input="text" to a javascript function ?

    Hello,
    I must do something like this (it doesn't work and I wonder if 'form' tag is necessary as well):
    Code:
    <head>
     <script language="JavaScript" type="text/javascript">  
        function createCalendar(form) {       
           alert("calendar" + form.date); 
           //here I must use 'date'
           //document.bgColor='yellow'"; //this doens't work
        }
     </script>
    </head>
    
    <form onsubmit="createCalendar(this);">
    Choose a date: <input type="text" size="15" name="date" />  
    <input type="button" value="Submit" id="mybutton2" />
    </form>
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Javascript questions should be asked on the javascript board.

    Comment

    • mickey0
      New Member
      • Jan 2008
      • 142

      #3
      Originally posted by drhowarddrfine
      Javascript questions should be asked on the javascript board.
      I moved it. Please anyone delete this post. thanks

      Comment

      Working...