final ; in javascript required?

For general web development questions that are not specifically related to CSS HTML Validator. This includes (but is not limited to) general HTML, CSS, Accessibility, JavaScript, and SEO questions.
flashbrack
Rank 0 - Newcomer
Posts: 1
Joined: Wed Sep 28, 2011 10:07 pm

final ; in javascript required?

Post by flashbrack »

I am new to the CSE HTML validator (very impressed with it), also an amateur web designer. So excuse me if this is a naive question.

I have a javascript function as below on my frameset index.htm page. (Yes I know frames are now deprecated and will eventually switch to iframes).

<script type="text/javascript">
var fname="main"; //MAIN CONTENT AREA FRAME **NAME**
window.onload=function(){
var d=document.location.search;
if(d!=='')top.frames[fname].document.location.href=d.substring(d.lastIndexOf('?')+1,d.length);
};
</script>

Which I found on the web to handle redirection to a requested page after reloading the frameset, when the page has been addressed directly.

My question regards the final ";" after the function's closing "}", which I added to satisfy the javascript lint component of CSE validator pro. It seems non-standard, why is it required? The script works fine with it or without it. I have been unable to find a reference to this syntax on the W3C site.

Not a big deal, just curious.
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: final ; in javascript required?

Post by Albert Wiersch »

Hello,

I tried to reproduce this but couldn't get JavaScript Lint to produce any messages at all, other than the "[JavaScript Lint] 0 error(s), 0 warning(s)" one. Can you supply a full document that reproduces the problem? Have you changed any JavaScript Lint options from the default?

Thank you.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial