473,785 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trigger change event (urgent)

I have Googled a lot, but couldn't still find the answer...

I could see, I can trigger the "click" event like:
button_object.C lick()

But, I need to trigger the onChange() of select options. I couldn't
find anything like:
select_object.C hange()

More specifically, I have something like:
<select name="sel" onChange="alert (this.selectedI ndex)">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>

and I have something in JS like:
form1.sel.selec tedIndex = 2; //changing
If I change the index, it doesn't trigger the onChange event. I
wish to trigger the change event. Is there anyway to go with
JavaScript or JScript? TIA.

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 23 '05 #1
2 17518
R. Rajesh Jeba Anbiah wrote:
<snip>
and I have something in JS like:
form1.sel.selec tedIndex = 2; //changing

<snip>

Assuming - form1 - is a local variable holding a reference to the form
element (rather than a browsers specific shortcut reference, with the
consequent removal of any hope of cross browser support for a task that
every javascript enabled browser is capable of), then you can just call
the - onchnge - handler function yourself as:-

form1.sel.oncha nge();

Richard.
Jul 23 '05 #2
"Richard Cornford" <Ri*****@litote s.demon.co.uk> wrote in message news:<c5******* ************@ne ws.demon.co.uk> ...
R. Rajesh Jeba Anbiah wrote:
<snip>
and I have something in JS like:
form1.sel.selec tedIndex = 2; //changing

<snip> then you can just call
the - onchnge - handler function yourself as:-

form1.sel.oncha nge();


Oh cool! Thanks a lot. Never thought that it will be this much
easier:) Thanks again.

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 23 '05 #3

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

Similar topics

4
4017
by: Peter Lin | last post by:
Dear all; I need to monitor a xml file so that I can update my data in hashtable, but the problem is it will trigger more than one event for a lastwrite action(I trigger this action by add something in the xml file using notepad). Here is my codes about using FilesystemWatcher fileWatcher=new FileSystemWatcher(); fileWatcher.Path=System.Environment.CurrentDirectory; fileWatcher.NotifyFilter=NotifyFilters.LastWrite;
2
3976
by: Owin | last post by:
Hi all, I've created an User control. It's an extension of a textbox wich has some extra properties so that validation becomes a lot faster. The control wordks great if autopostback is on. When there's a value in the textbox, the (overridden) textchanged event fires and validation is performed. Now I want to turn off autopostback. So I want my contol only validate if the submit button is pressed. I've tried Page.Validate(), but It seems...
3
6167
by: David | last post by:
Hi If I change the checked value of the checkbox by code, I can not trigger the CheckedChanged event of a checkbox control. Is there any way to implement it? Thank you very much!
1
2899
by: Zyrthofar | last post by:
Hi I have three textboxes indicating the individual RGB values of a color. When the user leaves a textbox (Leave event), I check the validity of that number and saves the three values to a set of raw data... The sub used handles the three textboxes's Leave events, and uses the 'sender' variable... Now I have a picturebox with GDI+ circles in it, representing the 8 different colors in the palette. You can choose the color number by...
8
2638
by: Frank van Vugt | last post by:
Hi, If during a transaction a number of deferred triggers are fired, what will be their execution order upon the commit? Will they be executed in order of firing or alfabetically or something entirely different? The docs only mention regular triggers being executed alfabetically.
0
2638
by: wugon.net | last post by:
Hi , Anyone know how to monitor db2 trigger activity ? We suffer some trigger issue today and we try to monitor trigger's behavior use event monitor and db2audit, but both tools can not get trigger's sql statment and cost, have other tools can get trigger's executing sql statment and cost ? our test case as follow: Env:
13
2423
by: Screaming Eagles 101 | last post by:
Hi, I have a solution containing two projects - main project with main form containing a statusstrip - second project containing a usercontrol. I have added the usercontrol to my main form, all works perfect... Can my usercontrol 'fire an event' which allows it to change the value(s) on the main form's statusstrip ?
1
7024
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the page has multiple button such login page with a search function somewhere around, then it's not respond properly. I have attached a brief example of two text boxes and two button. When ever a key is press on textbox one, I want to trigger...
4
15482
by: Michael | last post by:
I have a repeater web control. Currently I want to change some row's color based on defined condition. Is there any code sample demonstrating how to accomplish it? Thanks.
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.