Thanks for making your online lint utility available!
I am having difficulty understand an error detected by the online lint checker though.
I recieve a "lint warning: missing semicolon" message pointing at line 13 and don't see the need for a semicolon in the place lint suggests it should be.
…don't see the need for a semicolon in the place lint suggests it should be.
Any suggestions?
Yes! - always write well-formatted strict, clean code.
Why do you want to save semi-colons? - they don't cost anything (nor do spaces, which can make your code more readable for others).
All statements should always be terminated and separated with the appropriate separator when one is available for the language. Don't try to see what lax, lazy coding you can get away with!
So try writing this instead:
functionvalidate(){if(document.login.userName.value==""){alert("Please enter User Name");returnfalse;}if(document.login.password.value==""){alert("Please enter Password");returnfalse;}returntrue;}
Regards
Christophe
(Computer engineer, programmer in 'C', HTML, CSS and JavaScript
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for making your online lint utility available!
I am having difficulty understand an error detected by the online lint checker though.
I recieve a "lint warning: missing semicolon" message pointing at line 13 and don't see the need for a semicolon in the place lint suggests it should be.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Login Example 2</title>
</head>
<script>
function validate()
{
if(document.login.userName.value==="")
{
alert("Please enter User Name")
return false
/* =^
lint warning: missing semicolon */
}
if(document.login.password.value==="")
{
alert("Please enter Password");
return false
}
}
</script>
<body>
<form name="login" onSubmit="return validate()">
<input type="text" size="20" name="userName">
<input type="text" size="20" name="password">
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
I'm probably missing something simple here. Any suggestions?
Tia
Hello
Yes! - always write well-formatted strict, clean code.
Why do you want to save semi-colons? - they don't cost anything (nor do spaces, which can make your code more readable for others).
All statements should always be terminated and separated with the appropriate separator when one is available for the language. Don't try to see what lax, lazy coding you can get away with!
So try writing this instead:
Regards
Christophe
(Computer engineer, programmer in 'C', HTML, CSS and JavaScript