When you are using return true or false with markup, you are indicating
whether or not you want the default action to happen after the javascript
has been executed. An example is needed:
<a href="somepage.html" onClick="alert('Hi'); return true;">Click Me</a>
When the link is clicked the javascript code for the onClick will run first,
and we get an alert. We have used return true, so that is saying when we
click OK to remove the alert, we do want to run the markup. So in this case
once we click OK to dismiss the alert, we would then be taken to
somepage.html. If we changed that to return false we would get the alert,
but wouldn't go to somepage.html.
whether or not you want the default action to happen after the javascript
has been executed. An example is needed:
<a href="somepage.html" onClick="alert('Hi'); return true;">Click Me</a>
When the link is clicked the javascript code for the onClick will run first,
and we get an alert. We have used return true, so that is saying when we
click OK to remove the alert, we do want to run the markup. So in this case
once we click OK to dismiss the alert, we would then be taken to
somepage.html. If we changed that to return false we would get the alert,
but wouldn't go to somepage.html.
0 comments:
Post a Comment
Thanks for your valuable Comment