[thelist] [JS] trying to do a bookmarklet and failing

liorean liorean at f2o.org
Fri May 28 12:10:04 CDT 2004


Tom Dell'Aringa wrote:
> Thanks David, the comma worked :). I don't quite understand why you
> can put a comma there, but hey it works. Intuitively, you'd think you
> would use a semi-colon to break up the statements. If I put a comma
> in a normal script it blows. I guess it sees it as two arguments
> instead?

Because the semicolon is a statement terminator, while we are here working on an expression level:

To quote the ECMA-262 3ed. specification:
    Expression:
	AssignmentExpression
	Expression , AssignmentExpression

That is, "blah1, blah2" is one expression consisting of two expressions...
 
> A lot of them I saw simply used the href="javascript: statements...;;" and I tried that too - which didn't work. 

The final expression must to be non-returning for it to work. Wrapping the last expression in void(...) makes an expression non-returning. 
-- 
David "liorean" Andersson

ViewStyles, ViewScripts, SwitchStyles and GraphicsInfo bookmarklets:
<http://liorean.web-graphics.com/>
Hangouts:
<http://codingforums.com/> <http://yourmusicforums.com/>


More information about the thelist mailing list