+ 1
Why is there always an unexpected token < in my output where i have written <script>?
4 Réponses
+ 26
Please post your code so we could solve this problem.
+ 3
How can we tell you without seing your code? @@
+ 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
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>