+ 1

Why is there always an unexpected token < in my output where i have written <script>?

1st Mar 2017, 4:49 PM
Sohom roy
Sohom roy - avatar
4 Answers
+ 26
Please post your code so we could solve this problem.
1st Mar 2017, 5:30 PM
Igor Makarsky
Igor Makarsky - avatar
+ 3
How can we tell you without seing your code? @@
2nd Mar 2017, 8:41 AM
visph
visph - avatar
+ 3
I'm not getting the same error than you describe... The mistake in the JS code is the unexpected semi-colon ( "unexpected else" literally ) at the end of the if statement line. Anyway, you've a mistake in your Html code also: you put an supplementary unecessary <form> opening tag :P
2nd Mar 2017, 9:04 AM
visph
visph - avatar
0
<html> <script> function roy() { var a=document.forms["myform"]["pname"].value; var b=document.forms["myform"]["qname"].value; if(a==""||b==""); alert("PLEASE FILL THE empty spaces") else alert("thank you"); } </script> <body> <form> <form name="myform" onsubmit=" roy() " > USERNAME:<input type="text" name="pname"><br> PASSWORD:<input type="text" name="qname"><br> <center><input type="submit" value="SUBMIT"></center> </form> </body> </html>
2nd Mar 2017, 8:54 AM
Sohom roy
Sohom roy - avatar