I have a funny complication i would like to understand, if i have window.open as the onclick event of an anchor, a new tab is opened as required. If the onclick calls a function, which in turn does a window.open a new tab is opened, but also the current tab gets the new url as well.
I can demonstrate it here it works ok when you click on the link, wheras here the url is also opened in the results area as well !
Thanks
Symeon.
Your first
casestatement is falling through. You need to add abreak:Without the
break, everycasebelow the one that was first matched will be executed.I have added a
breakto the second case too, simply because it’s generally considered good practice to alwaysbreaka case. In fact, JSLint will flag a missingbreakas an error.