html - unresponsive javascript, on clicking submit -
Below is a part of the code in my project, after submitting the form to the database, I have to show another php page to javascript Want to For the test purpose I tried a simple warning box to appear on the click of submission of the form button. But the script does not show any response
& lt; Width of table = "100%" height = "100%" range = "0" & gt; & Lt; TR & gt; & Lt; Td height = "31" & gt; & Lt; Form onsubmit = "open ()" action = "addguestbook.php" method = "post" & gt; & Lt; Font face = "wordana" size = "2" & gt; Name: & lt; / Font & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Input type = "text" name = "name" & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Font face = "wordana" size = "2" & gt; E-mail: & lt; / Font & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Input type = "text" name = "email" & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td height = "31" & gt; & Lt; Font face = "wordana" size = "2" & gt; Comment: & lt; / Font & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Textarea rows = "4" name = "comment" cols = "23" rap = "hard" & gt; & Lt; / Textarea & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td height = "31" & gt; & Amp; Nbsp; & Lt; / Td> & Lt; TD & gt; & Lt; Input type = "submit" value = "submit" & gt; & Amp; Nbsp; & Nbsp; & Amp; Nbsp; & Nbsp; & Nbsp; & Lt; Input type = "reset" value = "reset" & gt; & Lt; / Form & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; Strong> & Lt; A href = "viewguestbook.php" & gt; View gallery & lt; / A & gt; & Lt; / Strong> & Lt; Script & gt; Open the ceremony () {Warning ("Welcome"); } & Lt; / Script & gt;
Some points:
-
Lt; Table & gt;
, & lt; Tr & gt;
, & lt; Td>
and other tabular elements should be used only for tableular data. This is not your case. Instead, consider using a CSS table. -
& lt; Font & gt;
Elements were excluded in 4.01. Use CSS instead. - Avoid inline JS Event listeners, use JS instead of HTML.
- Avoid Global Functions, which can fight with native people.
Try this:
& lt; Form id = "addGuest" action = "addguestbook.php" method = "post" & gt; & Lt; Label class = "row" & gt; & Lt; Period & gt; Name: & lt; / Span & gt; & Lt; Input type = "text" name = "name" /> & Lt; / Labels & gt; & Lt; Label class = "row" & gt; & Lt; Period & gt; E-mail: & lt; / Span & gt; & Lt; Input type = "text" name = "email" /> & Lt; / Labels & gt; & Lt; Label class = "row" & gt; & Lt; Period & gt; Comment: & lt; / Span & gt; & Lt; Textarea rows = "4" name = "comment" cols = "23" rap = "hard" & gt; & Lt; / Textarea & gt; & Lt; / Labels & gt; & Lt; Duration class = "row push" & gt; & Lt; Input type = "submit" value = "submit" /> & Lt; Input type = "reset" value = "reset" /> & Lt; / Span & gt; & Lt; / Form & gt;
#addGuest {display: table; Width: 100%; } #addGuest & gt; .row {font-family: Verdana; Font-size: .8em; Exhibit: table-row; } #addGuest & gt; .oo & gt; Period {Performance: Table-room; Vertical-alignment: top; } #addGuest & gt; .ro.push: first {content: ''; Exhibit: Table-Cell; } document.getElementById ('addGuest'). Onsubmit = function () {Alert ("Welcome"); };
Comments
Post a Comment