IT Community - Software Programming, Web Development and Technical Support

How to do click operation on a button programmatically using JavaScript?

This is a discussion on How to do click operation on a button programmatically using JavaScript? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; How to do click operation on a button programmatically using JavaScript...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-21-2007, 12:41 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Question How to do click operation on a button programmatically using JavaScript?

How to do click operation on a button programmatically using JavaScript
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-21-2007, 01:27 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Re: How to do click operation on a button programmatically using JavaScript?

Hi.. Please try this..

Using CodeBehind

protected void Button1_Click(object sender, EventArgs e)
{
this.Label1.Text = "Button1 clicked!";
}

protected void Button2_Click(object sender, EventArgs e)
{
somefunction();
}

private void somefunction()
{
string sender = "";
EventArgs e = new EventArgs();
this.Button1_Click(sender, e);
}

Using JavaScript

var mybutton = document.getElementById(yourButtonName);
if (mybutton)
{
mybutton.click();
}
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call a javascript function in a client side click? leoraja8 ASP and ASP.NET Programming 4 10-30-2007 01:43 AM
I get a javascript error when I click on my calendar Pvinothkumar HTML, CSS and Javascript Coding Techniques 1 09-13-2007 06:04 AM
I am having checkbox in datagrid and treeview, while click the button i need to check kingmaker C# Programming 3 08-14-2007 09:39 AM
I keep getting "Data Missing" when I click the "back" button in my browser. How can I oxygen HTML, CSS and Javascript Coding Techniques 1 07-28-2007 01:12 AM
Can I make a button on my page work as the browser's Back button in javascript? kingmaker HTML, CSS and Javascript Coding Techniques 1 07-26-2007 01:27 AM


All times are GMT -7. The time now is 04:19 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0