I wrote this script for javascript disabled browser.
Here is HTML:
<a href="http://www.google.com/" onClick="jstest();">Google</a>
Here is Javascript:
<script type="text/javascript">
function jstest() {
alert("Success");
// show popup
return false;
};
</script>
If javascript is enabled it should alert a popup showing success. And if it is disabled it should move to google page. I was told to do this by a friend. It works on jsFiddle.net. But not working if i try to do this in my work.
It shows popup when i click and when i close popup it moves onto google page.
I want it to stay on the same page. I dont want it to move on link page.
It should move only if javascript is disabled.
What have i done wrong in this script?
Thank You,
Kishore.
Try this as your hyperlink:
The return within the onClick should confirm that the return false from your function should bubble up to the hyperlink’s behavior.