| | |
What's the difference..?
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Sep 2009
Posts: 16
Reputation:
Solved Threads: 0
Hi can someone please explain to me what is the difference between writing
onclick="confirmLink()"
and
onclick="return confirmLink()"
I tried both and they did the same thing and I am confused since the lazy fellows from my university have given me old notes in which they randomly include the "return" sometimes and sometimes they don't in the various examples.
onclick="confirmLink()"
and
onclick="return confirmLink()"
I tried both and they did the same thing and I am confused since the lazy fellows from my university have given me old notes in which they randomly include the "return" sometimes and sometimes they don't in the various examples.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<html> <head> <title>Handling onClick for links</title> <script> <!-- function confirmLink() { alert("This is the Mastering JavaScript and JScript Home Page."); return confirm("Are you sure you want to load this document?") } //--> </script> </head> <body> <h1>Handling onclick for links</h1> <p> <a href="http://www.jaworks.com/javascript" onclick="confirmLink()">Asks you to confirm your selection of this link.</a> </p> </body> </html>
Last edited by DARK_BYTE; Oct 22nd, 2009 at 4:30 pm.
0
#3 Oct 22nd, 2009
Try this example:
Run this u will get all ur answers.
html Syntax (Toggle Plain Text)
<html> <head> <title>Handling onClick for links</title> <script> <!-- function confirmLink() { alert("This is the Mastering JavaScript and JScript Home Page."); return confirm("Are you sure you want to load this document?") } //--> </script> </head> <body> <h1>Handling onclick for links</h1> <p> <a href="http://www.jaworks.com/javascript" onclick="">without retrun.</a><br> <a href="http://www.jaworks.com/javascript" onclick="return">with only retrun.</a><br> <a href="http://www.jaworks.com/javascript" onclick="return true;">with retrun true.</a><br> <a href="http://www.jaworks.com/javascript" onclick="return false">And with retrun false.</a><br> </p> </body> </html>
Run this u will get all ur answers.
When you think you have done a lot, then be ready for YOUR downfall.
![]() |
Similar Threads
- what is the difference between regular and 64 bit edition (Windows NT / 2000 / XP)
- Should replacing a 15" laptop screen with 14.1" make a difference? (Monitors, Displays and Video Cards)
- 56k and 56k/v90 difference? (Windows 95 / 98 / Me)
- date difference in c++ (C++)
- Drawbacks And Difference (C)
- "difference patching" help (C)
- The difference between functions and templates? (C++)
- Difference (Web Browsers)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Table id
- Next Thread: mailto error handling
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxjspservlets array browser bug calendar captchaformproblem cart checkbox child class close codes createrange() cursor date debugger decimal dependent disablefirebug dom dropdown editor element embed engine enter events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl listbox maps masterpage math media menu object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post programming progressbar prototype redirect regex runtime safari scale scriptlets scroll search security shopping size software sql text textarea toggle unicode web windowsxp wysiwyg \n





