javascript not working on form -
can tell me why script in header tag doesn't work. can form show up, enter of information, click submit don't output show up. i've looked @ code on , on don't see problem is. appreciate help. teacher @ school doesn't much.
<!doctype html> <html> <head> <title> event scheduler </title> </head> <body> <header> <script> function scheduledevent(evtdate, evttitle, maxattendees, coordinator, phonenum, email, infourl, printevent) { this.evtdate = evtdate; this.evttitle = evttitle; this.maxattendees = maxattendees; this.coordinator = coordinator; this.phonenum = phonenum; this.email = email; this.infourl = infourl; this.printevent = printevent; function printevent() { document.write("<p>you have scheduled event named " + this.evttitle); document.write(" occur on " + this.evtdate + " , allow " + this.maxattendees + " attendees."); document.write("the event coordinated " + this.coordinator + " can reached @ " + this.phonenum); document.write(" or email @ " + this.email + ". "); document.write("more information event available @ <a href= '" + this.infourl + "'> " + this.infourl + "</a></p>"); } function validate() { (document.evtform) { evt = new scheduledevent(evtdate.value, evttitle.value, maxattendees.value, evtcoordinator.value, phonenum.value, email.value, infourl.value); } (evt) { evt.printevent(); } return true; } </script> </header> <form name= "evtform" method= "post"> <table> <tr> <td> event date: </td><td><input type= date id= "evtdate" /></td></td> <tr><td>title:</td><td><input id= "evttitle" /></td></tr> <tr><td> maximum attendees: </td><td><input id= "evtcoordinator" /><td></tr> <tr><td> phone number (numbers only): </td><td><input type= tel id= "phonenum" /> </td></tr> <tr><td> email: </td><td><input type= email id= "email" /></td></tr> <tr><td> more info: </td><td><input type= url id= "infourl" /></td></tr> </table> <input type= submit value= "submit" /> </form> </body> </html>
well input fields missing quotations arround name attributes.
you have:
<input type= date id= "evtdate" />
when should have:
<input type="date" id="evtdate" />
you not doing on click of submit button.
you need start function somehow in click method or something. seem expect magically start working.
Comments
Post a Comment