ASP button does not work when running from the script?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • esoroka@gmail.com

    #1

    ASP button does not work when running from the script?

    Hello,

    Trying to run a script what start ASP button:

    document.Form1. all["btnNewPassUpda te"].click();

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

    A full script is as follows:
    <script language="javas cript" type="text/javascript">
    function ChangePass(NewP ass)
    {
    var windowsize
    "center:yes;dia logHeight:230px ;dialogWidth:43 0px;toolbar:no; menubar:no;stat us:no;directori es:no;scrollbar s:no;location:n o;resizable=no" ;

    var retVal;
    NewPass = window.showModa lDialog("Change Password.aspx?" ,"",windowsize) ;
    if(NewPass !== "")
    {
    document.Form1. all["txbNewPass "].value = NewPass;
    return document.Form1. all["btnNewPassUpda te"].click();
    }
    else return false;
    }
    </script>

    Thanks,
    eugene

  • kaeli

    #2
    Re: ASP button does not work when running from the script?

    In article <1116881340.632 484.118800@o13g 2000cwo.googleg roups.com>,
    esoroka@gmail.c om enlightened us with...[color=blue]
    > Hello,
    >
    > Trying to run a script what start ASP button:
    >
    > document.Form1. all["btnNewPassUpda te"].click();
    >[/color]

    You might want to get used to document.getEle mentById instead of
    document.all.
    [color=blue]
    > It is work one time only. Next script ignore it. Where can be
    > problem???[/color]

    A script error halting execution. Do you have MSIE set to display all script
    errors? When developing, you should.
    [color=blue]
    >
    > A full script is as follows:
    > <script language="javas cript" type="text/javascript">
    > function ChangePass(NewP ass)
    > {
    > var windowsize
    > "center:yes;dia logHeight:230px ;dialogWidth:43 0px;toolbar:no; menubar:no;stat us:no;directori es:no;scrollbar s:no;location:n o;resizable=no" ;
    >[/color]

    Missing an equal sign for assignment or something. Typo?
    The above makes no sense.
    [color=blue]
    > var retVal;
    > NewPass = window.showModa lDialog("Change Password.aspx?" ,"",windowsize) ;
    > if(NewPass !== "")[/color]

    !== ?
    That is not valid as far as I know for javascript. You want != instead.
    [color=blue]
    > {
    > document.Form1. all["txbNewPass "].value = NewPass;
    > return document.Form1. all["btnNewPassUpda te"].click();[/color]

    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.



    Comment

    • esoroka@gmail.com

      #3
      Re: ASP button does not work when running from the script?

      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.getEle mentById 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­Upd ate"]
      Moreover it perfectly worked before.
      2. return document.Form1. all["btnNewPass­Upd ate"].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...

      Comment

      • Random

        #4
        Re: ASP button does not work when running from the script?

        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.



        esoroka@gmail.c om wrote:[color=blue]
        > 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.getEle mentById 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­Upd ate"]
        > Moreover it perfectly worked before.
        > 2. return document.Form1. all["btnNewPass­Upd ate"].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...[/color]

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: ASP button does not work when running from the script?

          esoroka@gmail.c om wrote:
          [color=blue]
          > 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][/color]

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


          PointedEars

          Comment

          Working...