Javascript:void(0); help!

Hi,

Im using the below script to close a Shadowbox window. Its working just fine. The issue is that it returns to the parent page. I need it to close and go to a new page like www.google.com. Is that possible using this script? What needs to be changed? Any suggestions?

<a href=\\"Javascript:void(0);\\" onclick=\\"parent.location.reload();window.parent.Shadowbox.close();\\">Use this photo as my profile photo</a>

Hi GertK, I can’t test this as I’m using my phone to reply but try this:


<a href=\\"Javascript:void(0);\\" onclick=\\"window.parent.Shadowbox.close();location.href='http://google.com';\\">Use this photo as my profile photo</a>

Never use JavaScript in the href attribute unless the intention is for people to be able to right click and bookmark it.

Best also to not use JavaScript in the HTML at all but to place it in a separate file.

If the intention isn’t to have the link go somewhere when JavaScript is disabled then you should use a <button> tag in place of the <a> tag.