473,322 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

ASP button does not work when running from the script?

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;t oolbar:no;menubar:no;status:no;directories:no;scro llbars:no;location:no;resizable=no";

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

Thanks,
eugene

Jul 23 '05 #1
4 2764
In article <11**********************@o13g2000cwo.googlegroups .com>,
es*****@gmail.com 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;t oolbar:no;menubar:no;status:no;directories:no;scro llbars: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?","",w indowsize);
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

Jul 23 '05 #2
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...

Jul 23 '05 #3
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.

es*****@gmail.com 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...


Jul 23 '05 #4
es*****@gmail.com 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
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
11
by: Dot net work | last post by:
Hello. I've read many posts about disabling submit buttons, but I can't get these answers to solve my problem. I have a server side asp.net button, and under the button I have code behind...
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
4
by: nicholas | last post by:
Weird thing: Got an aspx page with a button and an associated code in VB.net. On my testing server the page works fine. On the old hosters server the page worked fine too. But now, at the new...
7
by: Sridhar | last post by:
Hi, I have a question regarding the Page_Load method and Back Button of Internet explorer. I have created a webform. In that webform I have several Text Boxes. Also I have two buttons. When I...
11
by: cindy | last post by:
I have a form, has javascript registered so a modal pops up. Button click will close form. Now I need to do an update with modal form data before it closes. I can put a second button and register...
3
by: Jeff User | last post by:
Greeting I built asp.net (V1.1) page. I want to use this button to reset SelectedIndex=0 on several drop down lists. However, I do not want to post back to server. The point is to avoid the...
1
by: brianpmccullough | last post by:
I have an ASP.NET page that has a few buttons on it. One of the buttons kicks off a long running process on the web server and I want to prevent the user from clicking the button again while the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.