onclick event in FF doesn't work...

Discussion in '.NET' started by Misliplavo, Jun 26, 2009.

  1. Misliplavo

    Misliplavo

    Joined:
    Jun 26, 2009
    Messages:
    4
    Hi all
    I have a problem with FF and javascript...
    onclick event just wont fire...
    Should I say that it works in IE...

    Code behind :

    string javaScriptEvent = string.Empty;
    javaScriptEvent = string.Format("javascript:ChangeMessage({0});", this.hdnMessageStatus.ClientID);
    this.txtNewClubName.Attributes.Add("onblur", javaScriptEvent);
    // The first one works... (?!)

    javaScriptEvent = string.Format("javascript:return ValidateAddClub({0});", this.hdnValidationStatus.ClientID); // CllientID, UniqueID...
    this.lbtnAdd.Attributes.Add("onclick", javaScriptEvent);
    // This one doesn't...

    Javascript :

    function ChangeMessage(element) {
    element.value = 1 - element.value;
    __doPostBack(element.id, '');
    }

    function ValidateAddClub(element) {
    alert(element);
    if (element.value == "Free") {
    return true;
    }
    return false;
    }

    HTML : (page source)

    <div class="submiter">
    <a onclick="javascript:return ValidateAddClub(ctl00_cphPage_hdnValidationStatus) ;" id="ctl00_cphPage_lbtnAdd" class="roll" href="javascript:__doPostBack('ctl00$cphPage$lbtnA dd','')">ADD CLUB</a>
    </div>

    I would appreciate if someone could help me...
    Misliplavo, Jun 26, 2009
    #1
    1. Advertising

  2. Misliplavo

    Misliplavo

    Joined:
    Jun 26, 2009
    Messages:
    4
    Additional :

    I have checked in FireBug

    If I set this.hdnValidationStatus.ClientID it can not find control (first func still works)
    but if I set this.hdnValidationStatus.UniqueID there is no error at all, just don't fire onclick event ?!
    Misliplavo, Jun 26, 2009
    #2
    1. Advertising

  3. Misliplavo

    Misliplavo

    Joined:
    Jun 26, 2009
    Messages:
    4
    I have solved a problem...

    Instead of the LinkButton I have set the Button ...
    Misliplavo, Jun 26, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chad
    Replies:
    4
    Views:
    8,323
  2. Chu
    Replies:
    2
    Views:
    902
    Winista
    Apr 10, 2006
  3. loconel
    Replies:
    1
    Views:
    478
    Neredbojias
    Nov 17, 2005
  4. mbs57

    ASP.NET button control OnClick event doesn't fire

    mbs57, Jun 18, 2009, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    1,408
  5. kelvin

    onclick doesn't work

    kelvin, Apr 27, 2004, in forum: Javascript
    Replies:
    2
    Views:
    87
    kelvin
    Apr 30, 2004
Loading...

Share This Page