ASP button does not work when running from the script?

Discussion in 'Javascript' started by esoroka@gmail.com, May 23, 2005.

  1. Guest

    Hello,

    Trying to run a script what start ASP button:

    document.Form1.all["btnNewPassUpdate"].click();

    It is work one time only. Next script ignore it. Where can be
    problem???

    A full script is as follows:
    <script language="javascript" type="text/javascript">
    function ChangePass(NewPass)
    {
    var windowsize
    "center:yes;dialogHeight:230px;dialogWidth:430px;toolbar:no;menubar:no;status:no;directories:no;scrollbars:no;location:no;resizable=no";

    var retVal;
    NewPass = window.showModalDialog("ChangePassword.aspx?","",windowsize);
    if(NewPass !== "")
    {
    document.Form1.all["txbNewPass"].value = NewPass;
    return document.Form1.all["btnNewPassUpdate"].click();
    }
    else return false;
    }
    </script>

    Thanks,
    eugene
    , May 23, 2005
    #1
    1. Advertising

  2. kaeli Guest

    In article <>,
    enlightened us with...
    > Hello,
    >
    > Trying to run a script what start ASP button:
    >
    > document.Form1.all["btnNewPassUpdate"].click();
    >


    You might want to get used to document.getElementById instead of
    document.all.

    > It is work one time only. Next script ignore it. Where can be
    > problem???


    A script error halting execution. Do you have MSIE set to display all script
    errors? When developing, you should.

    >
    > A full script is as follows:
    > <script language="javascript" type="text/javascript">
    > function ChangePass(NewPass)
    > {
    > var windowsize
    > "center:yes;dialogHeight:230px;dialogWidth:430px;toolbar:no;menubar:no;status:no;directories:no;scrollbars:no;location:no;resizable=no";
    >


    Missing an equal sign for assignment or something. Typo?
    The above makes no sense.

    > var retVal;
    > NewPass = window.showModalDialog("ChangePassword.aspx?","",windowsize);
    > if(NewPass !== "")


    !== ?
    That is not valid as far as I know for javascript. You want != instead.

    > {
    > document.Form1.all["txbNewPass"].value = NewPass;
    > return document.Form1.all["btnNewPassUpdate"].click();


    Um, what's that supposed to do?
    Click is void.
    Syntax
    object.click()
    Return Value
    No return value.

    Are you mixing up vb and javascript syntax and operators, perhaps?

    --
    --
    ~kaeli~
    I love God. It's His fanclub that I can't stand.
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
    kaeli, May 24, 2005
    #2
    1. Advertising

  3. Guest

    Ok. Thank you for the answer. Some remarks:
    1. Do you have MSIE set to display all script errors?
    No. Where can I get it? URL please. Thank you.
    2. You might want to get used to document.getElementById instead of
    document.all.
    It does not matter because script can found the button. When I put
    alerts before/after
    this line it showed me that alert and also showed that object:
    all["btnNewPass­Update"]
    Moreover it perfectly worked before.
    2. return document.Form1.all["btnNewPass­Update"].click(); Um, what's
    that supposed to do?
    It supposed to click a small ASP button. When I click it manually my
    ASP code work well. But it ignore it in script in runtime. I also
    tried the case like this:
    document.Form1.all["ASPbtnName"].click();
    return true;
    same thing...
    , May 24, 2005
    #3
  4. Random Guest

    I've also had some finicky behavior trying to use .click() methods.
    Fortunately they're generally not necessary, so in general I work
    around them.

    If all you want is to submit the form, use the .submit() method of your
    form element. If you want to call the onclick event handler for your
    button, do so manually, then submit the form if appropriate.



    wrote:
    > Ok. Thank you for the answer. Some remarks:
    > 1. Do you have MSIE set to display all script errors?
    > No. Where can I get it? URL please. Thank you.
    > 2. You might want to get used to document.getElementById instead of
    > document.all.
    > It does not matter because script can found the button. When I put
    > alerts before/after
    > this line it showed me that alert and also showed that object:
    > all["btnNewPass­Update"]
    > Moreover it perfectly worked before.
    > 2. return document.Form1.all["btnNewPass­Update"].click(); Um, what's
    > that supposed to do?
    > It supposed to click a small ASP button. When I click it manually my
    > ASP code work well. But it ignore it in script in runtime. I also
    > tried the case like this:
    > document.Form1.all["ASPbtnName"].click();
    > return true;
    > same thing...
    Random, May 24, 2005
    #4
  5. wrote:

    > Ok. Thank you for the answer. Some remarks:
    > 1. Do you have MSIE set to display all script errors?
    > No. Where can I get it? URL please. Thank you.
    > [and so on]


    <http://jibbering.com/faq/>


    PointedEars
    Thomas 'PointedEars' Lahn, May 28, 2005
    #5
    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. Lucas Cowald
    Replies:
    0
    Views:
    407
    Lucas Cowald
    Oct 23, 2003
  2. nicholas

    asp.net button does not work

    nicholas, Mar 18, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    3,934
    nicholas
    Mar 18, 2005
  3. Grant Merwitz
    Replies:
    1
    Views:
    1,520
    =?Utf-8?B?QW1pdCBTYXZl?=
    Aug 23, 2005
  4. Phi!
    Replies:
    1
    Views:
    178
  5. Hugo Botha
    Replies:
    1
    Views:
    333
    Maarten
    Jul 11, 2004
Loading...

Share This Page