473,782 Members | 2,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reading 'type' from eventhandlers

I'm looking through the client side javascript reference and there's
some mighty useful information in here, but it is not very specific on
'reading' information from event handlers.

In the interest of streamlining my scripting, I was thinking I could
write multi-purpose functions to handle mouseOver and mouseOut events.
Thus far, I am manually passing if it is an Over or Out event, but it
occurs to me that there might be a way to read status of an event
somewhere. Alas, the web is so full of 'simple' mouseOver and
mouseOut handling, I have not as of yet refined a search enough to get
to the information I need.

I tried just doing a test against the element event [
if(elementObjec t.onmouseover) { doThis(); } ] but that does not seem
to work. What I am looking for is something like:

<a href="somedoc.h tm" onMouseOver="mo useEvent(this); "
onMouseOut="mou seEvent(this);" >some link text</a>
<SCRIPT language="javas cript"><!--
function mouseEvent(elem entObject) {
if(elementObjec t.onmouseover) { // or whatever syntax to test
doSomething();
} else if(elementObjec t.onmouseout) { // again, whatever...
doSomethingElse ();
}
}
// --></SCRIPT>
Thanks in advance for any help!

Kathy Lynn
Jul 20 '05 #1
3 2450
Hi Kathy (I note that Catherine starts with C),

If I understand you right, you are talking about
<a href="somedoc.h tm" onMouseOver="mo useEvent(this,e vent);"
onMouseOut="mou seEvent(this,ev ent);">some link text</a>

<SCRIPT type="text/javascript"><!--
function mouseEvent(elem entObject, evt) {
var e = evt || window.event;
if (e.type == "mouseover" ) { // double check capitalization
doSomething();
} else if(e.type=="mou seout") { // again, whatever...
doSomethingElse ();
}
}
// --></SCRIPT>

There have been several detailed discussions about these
types of events in the last few weeks. Perhaps do a google
search (in the groups tab) on
"Csaba Gabor" onmouseover
In particular, I recommend the two responses by
Lasse Reichstein Nielsen in the
..onmouseover=. .. syntax question re NN events
thread in this (comp.lang.java script) newsgroup as being
an excellent, detailed coverage.

Csaba Gabor from New York

PS. The this / elementObject are not required in the code above.
I left them in to show the structure. Another way (shown in the
google examples) is with e.target || e.srcElement (but this is not
necessarily the same as what you get with this. For example,
if you mouse over #text in a TD with the TD's onmouseover
set, the tartget will be the #text but the elementObject (this)
will give you the TD).
"Catherine Lynn Smith" <kl*****@hotmai l.com> wrote in message news:5f******** *************** ***@posting.goo gle.com...
I'm looking through the client side javascript reference and there's
some mighty useful information in here, but it is not very specific on
'reading' information from event handlers.

In the interest of streamlining my scripting, I was thinking I could
write multi-purpose functions to handle mouseOver and mouseOut events.
Thus far, I am manually passing if it is an Over or Out event, but it
occurs to me that there might be a way to read status of an event
somewhere. Alas, the web is so full of 'simple' mouseOver and
mouseOut handling, I have not as of yet refined a search enough to get
to the information I need.

I tried just doing a test against the element event [
if(elementObjec t.onmouseover) { doThis(); } ] but that does not seem
to work. What I am looking for is something like:

<a href="somedoc.h tm" onMouseOver="mo useEvent(this); "
onMouseOut="mou seEvent(this);" >some link text</a>
<SCRIPT language="javas cript"><!--
function mouseEvent(elem entObject) {
if(elementObjec t.onmouseover) { // or whatever syntax to test
doSomething();
} else if(elementObjec t.onmouseout) { // again, whatever...
doSomethingElse ();
}
}
// --></SCRIPT>
Thanks in advance for any help!

Kathy Lynn

Jul 20 '05 #2
OK, now I am running into a different situation that is sort of in the
same arena. I am going to trigger a setTimeout event from a onClick -
when it times out, I want to see if the person is still holding the
mouse down on that element. I assume the best way to do this would be
checking to see if a mouseDown event still exists in conjunction with
a mouseOver on the same object.

But I am still at a loss on the exact way to check if such events are
currently occuring nor how to check the mouseOver specific to that
element when the code that will be executed is spawned from the
timeout rather than an actual mouseOver.

Any help is appreciated. (even a RTFM that points me to a good source
for info)

KL

"Csaba2000" <ne**@CsabaGabo r.com> wrote in message news:<bk******* *@dispatch.conc entric.net>...
Hi Kathy (I note that Catherine starts with C),

If I understand you right, you are talking about
<a href="somedoc.h tm" onMouseOver="mo useEvent(this,e vent);"
onMouseOut="mou seEvent(this,ev ent);">some link text</a>

<SCRIPT type="text/javascript"><!--
function mouseEvent(elem entObject, evt) {
var e = evt || window.event;
if (e.type == "mouseover" ) { // double check capitalization
doSomething();
} else if(e.type=="mou seout") { // again, whatever...
doSomethingElse ();
}
}
// --></SCRIPT>

There have been several detailed discussions about these
types of events in the last few weeks. Perhaps do a google
search (in the groups tab) on
"Csaba Gabor" onmouseover
In particular, I recommend the two responses by
Lasse Reichstein Nielsen in the
.onmouseover=.. . syntax question re NN events
thread in this (comp.lang.java script) newsgroup as being
an excellent, detailed coverage.

Csaba Gabor from New York

PS. The this / elementObject are not required in the code above.
I left them in to show the structure. Another way (shown in the
google examples) is with e.target || e.srcElement (but this is not
necessarily the same as what you get with this. For example,
if you mouse over #text in a TD with the TD's onmouseover
set, the tartget will be the #text but the elementObject (this)
will give you the TD).
"Catherine Lynn Smith" <kl*****@hotmai l.com> wrote in message news:5f******** *************** ***@posting.goo gle.com...
I'm looking through the client side javascript reference and there's
some mighty useful information in here, but it is not very specific on
'reading' information from event handlers.

In the interest of streamlining my scripting, I was thinking I could
write multi-purpose functions to handle mouseOver and mouseOut events.
Thus far, I am manually passing if it is an Over or Out event, but it
occurs to me that there might be a way to read status of an event
somewhere. Alas, the web is so full of 'simple' mouseOver and
mouseOut handling, I have not as of yet refined a search enough to get
to the information I need.

I tried just doing a test against the element event [
if(elementObjec t.onmouseover) { doThis(); } ] but that does not seem
to work. What I am looking for is something like:

<a href="somedoc.h tm" onMouseOver="mo useEvent(this); "
onMouseOut="mou seEvent(this);" >some link text</a>
<SCRIPT language="javas cript"><!--
function mouseEvent(elem entObject) {
if(elementObjec t.onmouseover) { // or whatever syntax to test
doSomething();
} else if(elementObjec t.onmouseout) { // again, whatever...

doSomethingElse ();
}
}
// --></SCRIPT>
Thanks in advance for any help!

Kathy Lynn

Jul 20 '05 #3
Hi Kathy,

I responding from memory here, so everything I write is more
suspect than usual. However, from my recollection, this is a
tough problem (read: I didn't solve it). In particular (and someone
please correct me where I'm wrong), you can't check mouse status
like you could check for the control, shift, or alt key status.

Now, you could keep track of the mouse being released by
document.onmous eup and checking the target event appropriately.
Unfortunately, this method can be faked out. If I remember right, in
IE if you drag off the screen and return, mouse status is lost in some
circumtstances (though I just checked with a google button and the
button remembered on IE 5.5/Win 2K) - to compensate you can
include a check for the mouse leaving the document. I think Netscape
is nicer about this, and Opera is really whacky. (The following search
on google Groups gives discusses some aspects of this:
"csaba gabor" opera onmouseout).

Please do post back if you get somewhere on this. I'll be most
interested to learn more on this topic.

Regards,
Csaba Gabor from New York
"Catherine Lynn Smith" <kl*****@hotmai l.com> wrote in message news:5f******** *************** ***@posting.goo gle.com...
OK, now I am running into a different situation that is sort of in the
same arena. I am going to trigger a setTimeout event from a onClick -
when it times out, I want to see if the person is still holding the
mouse down on that element. I assume the best way to do this would be
checking to see if a mouseDown event still exists in conjunction with
a mouseOver on the same object.

But I am still at a loss on the exact way to check if such events are
currently occuring nor how to check the mouseOver specific to that
element when the code that will be executed is spawned from the
timeout rather than an actual mouseOver.

Any help is appreciated. (even a RTFM that points me to a good source
for info)

KL

"Csaba2000" <ne**@CsabaGabo r.com> wrote in message news:<bk******* *@dispatch.conc entric.net>...
Hi Kathy (I note that Catherine starts with C),

If I understand you right, you are talking about
<a href="somedoc.h tm" onMouseOver="mo useEvent(this,e vent);"
onMouseOut="mou seEvent(this,ev ent);">some link text</a>

<SCRIPT type="text/javascript"><!--
function mouseEvent(elem entObject, evt) {
var e = evt || window.event;
if (e.type == "mouseover" ) { // double check capitalization
doSomething();
} else if(e.type=="mou seout") { // again, whatever...
doSomethingElse ();
}
}
// --></SCRIPT>

There have been several detailed discussions about these
types of events in the last few weeks. Perhaps do a google
search (in the groups tab) on
"Csaba Gabor" onmouseover
In particular, I recommend the two responses by
Lasse Reichstein Nielsen in the
.onmouseover=.. . syntax question re NN events
thread in this (comp.lang.java script) newsgroup as being
an excellent, detailed coverage.

Csaba Gabor from New York

PS. The this / elementObject are not required in the code above.
I left them in to show the structure. Another way (shown in the
google examples) is with e.target || e.srcElement (but this is not
necessarily the same as what you get with this. For example,
if you mouse over #text in a TD with the TD's onmouseover
set, the tartget will be the #text but the elementObject (this)
will give you the TD).
"Catherine Lynn Smith" <kl*****@hotmai l.com> wrote in message news:5f******** *************** ***@posting.goo gle.com...
I'm looking through the client side javascript reference and there's
some mighty useful information in here, but it is not very specific on
'reading' information from event handlers.

In the interest of streamlining my scripting, I was thinking I could
write multi-purpose functions to handle mouseOver and mouseOut events.
Thus far, I am manually passing if it is an Over or Out event, but it
occurs to me that there might be a way to read status of an event
somewhere. Alas, the web is so full of 'simple' mouseOver and
mouseOut handling, I have not as of yet refined a search enough to get
to the information I need.

I tried just doing a test against the element event [
if(elementObjec t.onmouseover) { doThis(); } ] but that does not seem
to work. What I am looking for is something like:

<a href="somedoc.h tm" onMouseOver="mo useEvent(this); "
onMouseOut="mou seEvent(this);" >some link text</a>
<SCRIPT language="javas cript"><!--
function mouseEvent(elem entObject) {
if(elementObjec t.onmouseover) { // or whatever syntax to test
doSomething();
} else if(elementObjec t.onmouseout) { // again, whatever...

doSomethingElse ();
}
}
// --></SCRIPT>
Thanks in advance for any help!

Kathy Lynn

Jul 20 '05 #4

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

Similar topics

3
10808
by: Kiyomi | last post by:
Hello, I create a Table1 dynamically at run time, and at the same time, I would like to create LinkButton controls, also dynamically, and insert them into each line in my Table1. I would then like that, when clicking the LinkButton, the user can be navigated to another page, carrying a variable. I would like to use server.transfer method instead of QueryString as I don't want the carried variable to be visible for the user.
3
9396
by: Carl Lindmark | last post by:
*Cross-posting from microsoft.public.dotnet.languages.csharp, since I believe the question is better suited in this XML group* Hello all, I'm having some problems understanding all the ins and outs with datasets and datatables (and navigating through the filled datatable)... Just when I thought I had gotten the hang of it, another problem arose: I can't seem to access the "xsi:type" attribute. That is, the XML file looks
4
1841
by: MLH | last post by:
It has been mentioned that a ghosted machine or a machine linked by cable modem and USB may result in my reading a MAC address other than one burned onto a NIC in the machine. That being the case, I would have a problem. I am using the following code. Blindly, I grabbed it from an old post in this forum. It worked for me on one machine. I didn't give much thought to situations in which I might be reading unreliable data. If you know...
3
1887
by: Robert | last post by:
I need some assistance doing some "right way to do it" coding. The following are EventHandlers associated with Delegates in a child form that call a procedure in the MDI form that resets a timer. There must be a better way to code this than calling OnResetTimer in all these procedures separately. Is there not a way to use one handler for all of them? private void pnlCPI_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)...
1
1358
by: Timo | last post by:
I haven't tried coding eventhandlers in Global.asax yet -- any "gotchas" I should be aware of? Do programming errors there require bouncing IIS? Will handlers in Global.asax be able to access custom name/value pairs established in web.config (e.g. <add key="foo" value="bar" /> ) using ConfigurationSettings.AppSettings("foo") syntax? Thanks Timo
3
2962
by: Armin | last post by:
Hello I have a UserControl with a Click Event. Is it possible to find out the List of all Delegates/Eventhandlers using the Event. I read something about a "getinvocationlist" Methode for Delegates which can get this back, but couldN#t found out how it works.
1
2186
by: hzgt9b | last post by:
(FYI, using VB .NET 2003) Can someone help me with this... I'm trying to read in an XML file... it appears to work in that the DataSet ReadXML method dose not fail and then I am able to access the table names that are in the XML file, but I'm not able to access the rows. Here's the code that I've got - it assumes that the fileName passed in already exists: Public Sub GetInput(ByVal fileName As String) dsFileCopy = New...
1
1209
by: Kasper Birch Olsen | last post by:
Hi NG Im adding a bunch of linkbuttons to a page, in a for loop, but I cant get the eventhandlers to work. A simplyfied version of the code looks like this: for (int i = 0; i<10; i++) { Button b = new Button();
6
3531
by: efrenba | last post by:
Hi, I came from delphi world and now I'm doing my first steps in C++. I'm using C++builder because its ide is like delphi although I'm trying to avoid the vcl. I need to insert new features to an old program that I wrote in delphi and it's a good opportunity to start with c++.
0
9474
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
10308
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
9939
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
6729
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
5375
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...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
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
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
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.