| | |
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 |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child class close column createrange() css cursor date debugger dependent disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe images internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl math media microsoft mimic object onmouseoutdivproblem onreadystatechange parent paypal pdf php player position post problem programming progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





