By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,996 Members | 1,179 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,996 IT Pros & Developers. It's quick & easy.

User-Defined and/or User-Triggered Events

P: n/a
Hi,

Here I mean "User" in the Programmer or Javascript sense. I merely wish to
programmatically trigger an Event. It would be absolutely fantastic if there
was a (Form level?) ONUSEREVENT() and a setEvent() function but, in the
absence of this, is it not possible to use DOM to change an object's
properties resulting in a state-change event?

I have tried with ONCHANGE() and that only seems to work if the
"interactive" user changes the contents (i.e.
document.form.field.value="blah"; does not resuly in an ONCHANGE event.
Before I go through each event and property can someone tell me if it is at
all possible to use .select()/onselect or .focus()/onfocus (or anything!) to
queue an Event for processing?

Cheers Richard Maher


Mar 2 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi,

FWIW, If you use an object's .focus() method then it's ONFOCUS() event will
be triggered when you return from your current event processing. Any others?

Cheers Richard Maher

"Richard Maher" <ma******@hotspamnotmail.comwrote in message
news:es**********@news-01.bur.connect.com.au...
Hi,

Here I mean "User" in the Programmer or Javascript sense. I merely wish to
programmatically trigger an Event. It would be absolutely fantastic if
there
was a (Form level?) ONUSEREVENT() and a setEvent() function but, in the
absence of this, is it not possible to use DOM to change an object's
properties resulting in a state-change event?

I have tried with ONCHANGE() and that only seems to work if the
"interactive" user changes the contents (i.e.
document.form.field.value="blah"; does not resuly in an ONCHANGE event.
Before I go through each event and property can someone tell me if it is
at
all possible to use .select()/onselect or .focus()/onfocus (or anything!)
to
queue an Event for processing?

Cheers Richard Maher


Mar 3 '07 #2

P: n/a
VK
On Mar 3, 3:09 am, "Richard Maher" <maher...@hotspamnotmail.com>
wrote:
Hi,

Here I mean "User" in the Programmer or Javascript sense. I merely wish to
programmatically trigger an Event. It would be absolutely fantastic if there
was a (Form level?) ONUSEREVENT() and a setEvent() function but, in the
absence of this, is it not possible to use DOM to change an object's
properties resulting in a state-change event?

I have tried with ONCHANGE() and that only seems to work if the
"interactive" user changes the contents (i.e.
document.form.field.value="blah"; does not resuly in an ONCHANGE event.
Before I go through each event and property can someone tell me if it is at
all possible to use .select()/onselect or .focus()/onfocus (or anything!) to
queue an Event for processing?
Firefox: createEvent / dispatchEvent
IE: createEventObject / fireEvent

Mar 3 '07 #3

P: n/a
VK wrote :
On Mar 3, 3:09 am, "Richard Maher" <maher...@hotspamnotmail.com>
wrote:
>Hi,

Here I mean "User" in the Programmer or Javascript sense. I merely wish to
programmatically trigger an Event. It would be absolutely fantastic if there
was a (Form level?) ONUSEREVENT() and a setEvent() function but, in the
absence of this, is it not possible to use DOM to change an object's
properties resulting in a state-change event?

I have tried with ONCHANGE() and that only seems to work if the
"interactive" user changes the contents (i.e.
document.form.field.value="blah"; does not resuly in an ONCHANGE event.
Before I go through each event and property can someone tell me if it is at
all possible to use .select()/onselect or .focus()/onfocus (or anything!) to
queue an Event for processing?

Firefox: createEvent / dispatchEvent
dispatchEvent is just to dispatch the event to the target element.
http://www.w3.org/TR/2000/REC-DOM-Le...-dispatchEvent

DOM 2 Events initMouseEvent, createEvent and initEvent are what the OP
might (not sure) be looking for.

http://www.w3.org/TR/2000/REC-DOM-Le...vent-initEvent

http://www.w3.org/TR/2000/REC-DOM-Le...nt-createEvent

http://www.w3.org/TR/2000/REC-DOM-Le...nt-initUIEvent

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
Mar 4 '07 #4

P: n/a
Richard Maher wrote :
Hi,

Here I mean "User" in the Programmer or Javascript sense. I merely wish to
programmatically trigger an Event. It would be absolutely fantastic if there
was a (Form level?) ONUSEREVENT()
It depends. You have not given a lot of details here. Which form
control? Which user action? What kind of behavior? It could be, just a
guess, that you are looking for DOMActivate event.

and a setEvent() function but, in the
absence of this, is it not possible to use DOM to change an object's
properties resulting in a state-change event?

No details. No specifics. No url. No general description of what you are
actually looking to accomplish in a given webpage, having a specific
issue or something.
I have tried with ONCHANGE() and that only seems to work if the
"interactive" user changes the contents
change the contents: it could be that you are looking for mutation
events here.

(i.e.
document.form.field.value="blah"; does not resuly in an ONCHANGE event.
Before I go through each event and property can someone tell me if it is at
all possible to use .select()/onselect or .focus()/onfocus
onselect can be used only on input text form control and on textarea. If
you want to highlight a particular string on a webpage, that's a
different story. onfocus on a lot of element but not on any/all HTML
elements.
(or anything!) to
queue an Event for processing?
Not possible to queue an event really. Again, some of your questions
would be easier to answer if we knew exactly what you are trying to do:
general description, overview, which form control, what user action, etc.

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
Mar 4 '07 #5

P: n/a
Hi VK, Gerard,

Thanks for the replies. Please see below.

"Gérard Talbot" <ne***********@gtalbot.orgwrote in message
news:12*************@corp.supernews.com...
Richard Maher wrote :
Hi,

Here I mean "User" in the Programmer or Javascript sense. I merely wish
to
programmatically trigger an Event. It would be absolutely fantastic if
there
was a (Form level?) ONUSEREVENT()

It depends. You have not given a lot of details here. Which form
control? Which user action? What kind of behavior? It could be, just a
guess, that you are looking for DOMActivate event.

and a setEvent() function but, in the
absence of this, is it not possible to use DOM to change an object's
properties resulting in a state-change event?


No details. No specifics. No url. No general description of what you are
actually looking to accomplish in a given webpage, having a specific
issue or something.
I have tried with ONCHANGE() and that only seems to work if the
"interactive" user changes the contents

change the contents: it could be that you are looking for mutation
events here.

(i.e.
document.form.field.value="blah"; does not resuly in an ONCHANGE event.
Before I go through each event and property can someone tell me if it is
at
all possible to use .select()/onselect or .focus()/onfocus

onselect can be used only on input text form control and on textarea. If
you want to highlight a particular string on a webpage, that's a
different story. onfocus on a lot of element but not on any/all HTML
elements.
(or anything!) to
queue an Event for processing?

Not possible to queue an event really. Again, some of your questions
would be easier to answer if we knew exactly what you are trying to do:
general description, overview, which form control, what user action, etc.

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
Let me try to explain; painful experience coupled with the lack of responses
to my other "Stop! Button" thread has led me to the belief that it is simply
not possible (within the constrains of a Web Browser html,Javascrip,DOM) to
implement a a hot-abort or "Stop!" button that could interrupt, or bypass,
an ONevent long enough to use an Applet method to send an OOB character down
the socket, so that my server knows to stop what it's doing.

[Actually, it's a lot worse than that! The ludicrous state of affairs
witnessed just now on my IE6 Windows2000 session is that, whilst an ONevent
is currently executing my JS function, not only can I not press one of *my*
form buttons but the Global IE STOP button is also disabled and whatsmore is
if I try to close the bloody browser, Windows says "The program is not
responding" do I wish to kill it :-( And yes I have induced extended delays
with timed waits; elapsed-time is not the norm or expected behaviour.]

So, in desperate search of Plan B, I decided to look at the idea of
surrendering the event thread as often as possible so as to give all the
other events a window of opportunity to get on the event
stack/que/whateveryoucallit. This is how I'd imagine it "working": -

I send the work request down the socket via my applet. Now, instead of just
blocking on the Read I create a new applet method that does a
inputstream.available() and if I don't have enough bytes then I
fireEvent(this) and RETURN. If there are enough bytes then I continue with
the Read and process the server message then go again till EOF. Would it
work?

The main problem I have with it is the whole idea of polling is completely
anathema to me! I know PC people (and especially many web pages) do it all
the time, but it is simply badness. Having said that, would it work? Would
other events get through that tight little loop?

OK, I give up! Randy was right; just do it all in Java. When the user get's
the dialog box for username/password I'll stick another tick box that asks
if they want "CornuCopiaeControl". I suppose this could result in that
dangling dialog box with, in addition to a Stop button (that could change
color when it was active) I could put "Bytes sent, Bytes received, Connect
time, Username, HostName etc etc". Or I could forget the whole hot-abort
idea. Shit it was only meant to be a nice-to-have 'cos the server took
interrupts :-)

Alles klar?

Regards Richard Maher
Mar 4 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.