I have a very simple HTML file with javascript validation function, when I try to execute the form once the form is submitted I am doing However, I can not get the is_checked () function to run in the form of a console because the console log statement is not executed. I am using eclipse and Apache TomCat 7 server which is implementing all jsp, servlet, and HTML code properly, but there is no javascript.
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta charset = "ISO-8859-1" & gt; & Lt; Title & gt; Example & lt; / Title & gt; & Lt; Script type = "text / javascript" & gt; The function is_checked () {console.log (called "is_checked ()"); Var activated = document.getElementByID ('work'). Checked; Var Project checked = document. GetElementByID ('project'). Checked; Var autoChecked = document.getElementByID ('Auto'). Checked; Var manual che = document. GetElementByID ('manual'). Checked; Console Logs ("tasked" + propounded); Console.log ("Project Check" + Project Check); Console.log ("manual" check + manual check); Console.log ("Auto Check" + Automatically Check); If ((task checked) === "true". Project checked === "true") and amp; and (automatically checked === "true" manual = === " Very true; } And {warnings ('work or project must be selected and either auto or manual!'); return false; }} & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form action = "#" onsubmit = "return is_checked ()" method = "post" & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; Td> Processing level: & lt; / Td> & Lt; TD & gt; & Lt; Input type = "radio" name = "process" value = "task" id = "task" & gt; Work & lt; / Td> & Lt; TD & gt; & Lt; Input type = "radio" name = "process" value = "project" id = "project" & gt; Project & lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> Method type: & lt; / Td> & Lt; TD & gt; & Lt; Input type = "radio" name = "method" value = "auto" id = "auto" & gt; Auto & lt; / Td> & Lt; TD & gt; & Lt; Input type = "radio" name = "method" value = "manual" id = "manual" & gt; Manual & lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td colspan = "2" & gt; & Lt; Textarea name = "id" rows = "15" cols = "10" & gt; & Lt; / Textarea & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Input type = "submit" value = "submit" & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;
You have a typo: being document.getElementByID
You should call
with BTW, you are calling the function twice, you can remove onClick
in the submitted input
No comments:
Post a Comment