473,883 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is it possible, to generate an event on a text field?

Situation:

I have a few event handlers (not onclick) on a text box. The handlers
take in an event parameter to work some magic.

All the above works fine, but I have a desire/need, to "invoke" the
same handlers, but from another element (e.g. a separate button)

I know that someObject.clic k(); will actually work, but in my case, I
do not want to invoke the onclick handler.

Any Ideas?

PS I'd be happy to "fake" any of the following...

ondblclick
onkeydown
onkeyup
onkeypress

Cheers,
Steve

Jan 18 '07 #1
1 1636

st************* *@gmail.com wrote:
Situation:

I have a few event handlers (not onclick) on a text box. The handlers
take in an event parameter to work some magic.

All the above works fine, but I have a desire/need, to "invoke" the
same handlers, but from another element (e.g. a separate button)

I know that someObject.clic k(); will actually work, but in my case, I
do not want to invoke the onclick handler.

Any Ideas?

PS I'd be happy to "fake" any of the following...

ondblclick
onkeydown
onkeyup
onkeypress

Cheers,
Steve
Instead of 'faking' an event have you consdered doing the following:

in regular event handler call common_function ()

and then call common_function ()ality from both your event handler and
the other places that you need that behavior.

To answer your original question: In javascript inheritance is done by
making an object that looks like the original so you can always define
your own "event" with the properties that are referenced and then call
the events directly.

If you really want to go through the formal creation of an event object
then take a look at document.create Event / document.create EventObject /
target.dispatch Event / target.fireEven t.

- Craig Taylor
www.ctalkobt.net

Jan 18 '07 #2

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

Similar topics

12
12304
by: jaapkramer | last post by:
I have a page with 641 images in it. Each image can be clicked with as result that the image source will be changed. For this the images need to have a unique ID. But to do this manually for 641 is just too much. Is there a way to give each image his own unique id without setting them myself? The image: <img src="images/hokje.gif" id="" onClick="javascript:veranderKeuze(this.id);" alt="">
10
1679
by: pw | last post by:
Hi, Is that possible if the crosstab query is dynamic? Doesn't seem so as I have to specify the control source for the text boxes and the number of columns may change, along with their field names. Just thought I'd take a shot in the dark. -pw
8
1387
by: Thorsten Ottosen | last post by:
Dear all, I'm new to C#, so forgive my stupid question. In my question to avoid boilerplate code, I was wondering if I could use attributes to generate some code for me. For example public class Foo
8
4321
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image button at runtime: //----- Code snippet protected System.Web.UI.WebControls.PlaceHolder ImageHolder; private void Page_Load(object sender, System.EventArgs e)
6
2753
by: AA Arens | last post by:
Hi, I have a database with 2 main forms. Contacts and companies. I share the base with two others via LAN. On the companies form I have buttons to navigate throught the records (>400). We are mostly handling let say 5 companies. Every time I have to navigate or choose the find record button to get the right company. I am looking fo a feature to have listed in a combo list the last 5 visited records ("recently visited records").
15
3007
by: Orchid | last post by:
Hello, I am looking to generate a unique ID field on MS. Access. The ID is with 10 digits with the combination of 5 Letters from the 26 letters and 5 Numbers from 1 to 9. The letters and numbers are picked randomly. When I click a button with the VB code on a form, it will create the ID on a table call "Customer table". Can someone help me on how to write the VB code to generate the ID?? Thanks in advance for your help!!
51
4443
by: Paul Gorodyansky | last post by:
Hi, Ran into the following problem while trying to have a code to attach a Virtual Keyboard to any user's form: User clicks a button and my JavaScript changes outerHTML of say <textarea - adding things like ONCLICK='saveCaret(this)' etc. and it also tries to save any text that user could've entered before the button press.
9
1603
by: Asterbing | last post by:
Hi all, Don't know where to ask my question because the way to go is included in the possible answer itself by nature... You'll understand better below : Well, I have an HTML page containing a form in which an options group provides two ways to submit content of a file : - 1st way : base64 data in a textarea field. - 2nd way : path to local file in a file field
5
13041
topher23
by: topher23 | last post by:
I've seen a lot of questions about how to make secure database passwords. I'm going to go over a method of encrypting a password using the MD5 encryption algorithm for maximum security. First, you will need to download the attached class module (clsMD5.txt) and import it into your database. This class module is the core of what we're about to go over. Thanks to Robert Hubley for writing it - you're my hero! Next, your database needs a...
0
9942
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11147
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...
1
10855
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
10419
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
9577
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7974
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5994
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3236
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.