We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

pablazo on 09/19/07


Tagged

javascript links


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

joomla


assure a link is clicked once


Published in: JavaScript 


URL: http://www.codingforums.com/archive/index.php?t-45202.html

  1. <html>
  2. </head>
  3. <script language="Javascript">
  4. function disableAfterSubmit(object) {
  5. //object.outerHTML = object.innerHTML;
  6. //alert(object.href);
  7. document.forms[0].textField.value = document.forms[0].textField.value + "1" ;
  8. // to check that this is working fine, just comment line below and the page won't redirect to anywhere, but this function won't be entered again.
  9. // (you can see that it is true because no more "1" are added to the textField in the form)
  10. document.forms[0].submit();
  11. }
  12. </script>
  13. </head>
  14. <body>
  15. <form name="listForm" action="http://www.google.com/gwt/secondPage.htm">
  16. <input type="text" name="textField">
  17. <a href="javascript:disableAfterSubmit(this);" onclick="this.onclick=function(){return false;}">Link - Submit</a>
  18. </form>
  19. </body>
  20. </html>

Report this snippet 

You need to login to post a comment.