javascript command to implement button control

S

Steve

asp.net 2.0

I have a simple button control which implements some page behind code
when it is clicked.

I am looking for a simple javascript command which will in effect cause
a click on the button. i.e. act as if someone has clicked on the
button. i.e. do the same thing.

I will be calling this javascript command from another normal html
button on the page where I can't use asp.net. I know it seems like a
strange request, but there is a good reason for it.

Can anyone help?
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

document.getElementById('IdOfTheButtonToClick').click();
 
L

Laurent Bugnion

Hi,

Göran Andersson said:
document.getElementById('IdOfTheButtonToClick').click();

To be complete, this does not work in Firefox.

Looking for a better way now.

HTH,
Laurent
 
L

Laurent Bugnion

Laurent said:
Hi,




To be complete, this does not work in Firefox.

Of course it does. My wrong, sorry. I tested using a button with a
"name", but without an "id", and document.getElementById fails in
Firefox (which is correct). However it succeeds in IE (wrongly).

So to summarize, click() is also available in Firefox.

Sorry about the confusion.

Laurent
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top