Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to force a click on ASP.Net Button

Reply
Thread Tools

How to force a click on ASP.Net Button

 
 
BudhramM@gmail.com
Guest
Posts: n/a
 
      06-06-2006
Hi,

I have a webpage that has 2 ASP.Net buttons as well as some other
controls. The controls are split up into two, there is a set of Combo
boxes and then there is a single text input box. The controls are
seperated by DIV's to create a TABView. So when clicking on the 1st tab
will show the combo boxes and a button, the second tab will show a text
box and a button.

What I would like is for these buttons to be the default dependant on
which tab was selected. I have managed to find what tab is clicked, but
I need to know how I can set focus on a specified ASP.Net button.

Any ideas. You can view the site: http://www.kitchensink.co.za.

Thanx

 
Reply With Quote
 
 
 
 
nsimeonov@gmail.com
Guest
Posts: n/a
 
      06-06-2006
Hi,

here's how to "simulate" a button click:

document.forms[0].MyButton.click();

here's for example in an anchor tag:

<a href="javascript:document.forms[0].MyButton.click();">simulate
button click</a>

Also you may use the onkeypress event for the textbox:

<input type=text size=50 class="input_small" id=txtKeyword
name=txtKeyword onkeypress="if(event.keyCode==13){
doSearch(this.value); return false; }" >

Another solution would be to disable the button on the first tab when
the second one is active and vice versa.

Hope this helps,
Nikolay




написа:
> Hi,
>
> I have a webpage that has 2 ASP.Net buttons as well as some other
> controls. The controls are split up into two, there is a set of Combo
> boxes and then there is a single text input box. The controls are
> seperated by DIV's to create a TABView. So when clicking on the 1st tab
> will show the combo boxes and a button, the second tab will show a text
> box and a button.
>
> What I would like is for these buttons to be the default dependant on
> which tab was selected. I have managed to find what tab is clicked, but
> I need to know how I can set focus on a specified ASP.Net button.
>
> Any ideas. You can view the site: http://www.kitchensink.co.za.
>
> Thanx


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Nike air force one, air force 1, air force one low cut, air force one salewholeta@163.com Digital Photography 3 12-31-2008 04:29 PM
Nike Air Force Ones,Air Force One Air Force One-1 lky52193@gmail.com Computer Support 0 01-17-2008 04:40 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:46 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:34 PM



Advertisments