SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Using javascript in text links works but not buttons :(.

    If I do this:
    try { var myValidator = validate_SignUp; } catch(e) { return SignUp(); } return myValidator(this);

    in a regular hyperlink it will work but if I do it in a button using onclick="try { var myValidator = validate_SignUp; } catch(e) { return SignUp(); } return myValidator(this);" it does not work at all.

    Does anyone know why? How do I fix this?

    I am using Firefox btw
    Have a good day.

  2. #2
    SitePoint Member
    Join Date
    Aug 2008
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check This in both browser
    Code:
    <script>
    function validate_SignUp(obj){
    alert(obj.name);
    }
    </script>
     <BODY>
      <input type=submit name="try_btn" value=try onclick="try { var myValidator = validate_SignUp; } catch(e) { alert('1');return 1; } myValidator(this);">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •