473,386 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Check for support for hover on non <a> elements

Hi All!

Problem I began with: Netscape/Opera supports hover for different elements,
IE only supports hover for <a> and I want to use hover for <td class="menu">

I then found a fix using some Javascript here:
http://webpages.charter.net/mmmbeer/...bitrary-hover/

It works ok for IE now.

Problem I now have: I don't want the script to run in a browser that does
support hover for <td>.

In other words I noticed that the script was still running for Netscape and
Opera - but I would prefer to let those browser's native hover support to
work since I notice that in some cases the script can introduce lag at
loading time.

I don't want to sniff for IE: I know how unreliable browser sniffing is. I
would rather sniff for the lack of hover support.

Can anyone give me clues as to how this might be done?

Any help would be most appreciated!

Rob
:)
Jul 23 '05 #1
15 2794
On Tue, 27 Jul 2004 10:32:30 +1000, Robert Mark Bram <none> declared in
comp.lang.javascript,alt.html:
I don't want to sniff for IE: I know how unreliable browser sniffing is. I
would rather sniff for the lack of hover support.


You could use conditional comments. It's kind of browser sniffing, but
it is reliable.
http://msdn.microsoft.com/workshop/a...omment_ovw.asp

--
Mark Parnell
http://www.clarkecomputers.com.au
"Never drink rum&coke whilst reading usenet" - rf 2004
Jul 23 '05 #2
Hi Mark,

Thanks for the reply!
I don't want to sniff for IE: I know how unreliable browser sniffing is. I would rather sniff for the lack of hover support.


You could use conditional comments. It's kind of browser sniffing, but
it is reliable.
http://msdn.microsoft.com/workshop/a...omment_ovw.asp


Well, this seems to work ok:

<!--[if IE 5]>
<script language="javascript" type="text/javascript"
src="../bin/ieHoverFix.js"></script>
<![endif]-->

It feels like a hack.. *grin* but then again, just about every single
'advanced' thing I try to do in Javascript lately ends up feeling like a
hack! *sigh*

Rob
:)
Jul 23 '05 #3
On Tue, 27 Jul 2004 13:30:55 +1000, Robert Mark Bram <none> declared in
comp.lang.javascript,alt.html:
<!--[if IE 5]>
<script language="javascript" type="text/javascript"
src="../bin/ieHoverFix.js"></script>
<![endif]-->
Yep, that's the one. Note that the above will only affect IE5.x, not
IE6. Change the first line to <!--[if gte IE 5]> and it will work in
anything from IE5 up.
It feels like a hack..
It is. ;-)
*grin* but then again, just about every single
'advanced' thing I try to do in Javascript lately ends up feeling like a
hack! *sigh*


<g>

--
Mark Parnell
http://www.clarkecomputers.com.au
"Never drink rum&coke whilst reading usenet" - rf 2004
Jul 23 '05 #4
rf
Mark Parnell
Change the first line to <!--[if gte IE 5]>


<!--[if gte IE 5]-->

--
Cheers
Richard.
Jul 23 '05 #5
On Tue, 27 Jul 2004 04:22:35 GMT, rf <rf@.invalid> declared in
comp.lang.javascript,alt.html:
<!--[if gte IE 5]-->


No, that is then a normal HTML comment, so other browsers will still see
the stuff in between. If you wanted other browsers to see it and *not*
IE, you could do <!--[if !gte IE 5]-->

Fun for the whole family. :-)

--
Mark Parnell
http://www.clarkecomputers.com.au
"Never drink rum&coke whilst reading usenet" - rf 2004
Jul 23 '05 #6
rf

"Mark Parnell" <we*******@clarkecomputers.com.au> wrote in message
news:z2*****************************@40tude.net...
On Tue, 27 Jul 2004 04:22:35 GMT, rf <rf@.invalid> declared in
comp.lang.javascript,alt.html:
<!--[if gte IE 5]-->
No, that is then a normal HTML comment, so other browsers will still see
the stuff in between. If you wanted other browsers to see it and *not*
IE, you could do <!--[if !gte IE 5]-->


<runs to look at MS documentation>

Ah, so *that's* how the buggers work. Who'd have guessed :-)
Fun for the whole family. :-)


Indeed.

--
Cheers
Richard.
Jul 23 '05 #7
Robert Mark Bram wrote:


Well, this seems to work ok:

<!--[if IE 5]>
<script language="javascript" type="text/javascript"
src="../bin/ieHoverFix.js"></script>
<![endif]-->

Windows only, though.
Mick
Rob
:)

Jul 23 '05 #8
Mark Parnell wrote:
Yep, that's the one. Note that the above will only affect IE5.x, not
IE6. Change the first line to <!--[if gte IE 5]> and it will work in
anything from IE5 up.


Would it be better to use <!--[if IE]> to detect all versions of IE?
--
Michael Wilcox, http://mikewilcox.t35.com/
Jul 23 '05 #9
Mick White wrote:
Robert Mark Bram wrote:
Well, this seems to work ok:

<!--[if IE 5]>
<script language="javascript" type="text/javascript"
src="../bin/ieHoverFix.js"></script>
<![endif]-->


Windows only, though.
Mick


That's the whole point. He wants some hover behaviour to be
included only for IE. To other browsers the above code looks like
a comment. Only IE evaluates it, only IE will load the extenal JS
file. If IE7 (or 6.5 or 6.0SP2 or whatever) starts supporting
td:hover, he can change the condition to be something like:

<!--[if lt IE 7]>

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #10
Grant Wagner wrote:
Mick White wrote:
Windows only, though.
Mick

That's the whole point. He wants some hover behaviour to be
included only for IE.


The comments are ignored on IE Mac...
Mick

To other browsers the above code looks like a comment. Only IE evaluates it, only IE will load the extenal JS
file. If IE7 (or 6.5 or 6.0SP2 or whatever) starts supporting
td:hover, he can change the condition to be something like:

<!--[if lt IE 7]>

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #11
On Tue, 27 Jul 2004 14:29:06 GMT, Mick White
<mw******@BOGUSrochester.rr.com> wrote:
Grant Wagner wrote:
Mick White wrote:


Windows only, though.
Mick

That's the whole point. He wants some hover behaviour to be
included only for IE.


The comments are ignored on IE Mac...
Mick


That's not a problem, though, because IE Mac's rendering engine is
different from that of IE Dows.

--
Accessible web designs go easily unnoticed;
the others are remembered and avoided forever.
Jul 23 '05 #12
Michael Wilcox <mj************@yahoo.com> writes:
Would it be better to use <!--[if IE]> to detect all versions of IE?


Do you plan to maintain the page in all future?

Otherwise, I would recommend:
<!--[if lt IE 7]>
so that you don't block future versions unnecessarily.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #13
On Tue, 27 Jul 2004 11:26:05 -0400, Sam Hughes <hu****@rpi.edu> declared
in comp.lang.javascript,alt.html:
That's not a problem, though, because IE Mac's rendering engine is
different from that of IE Dows.


Does IE Mac support :hover on elements other than <a>?

--
Mark Parnell
http://www.clarkecomputers.com.au
"Never drink rum&coke whilst reading usenet" - rf 2004
Jul 23 '05 #14
Mark Parnell wrote:
Does IE Mac support :hover on elements other than <a>?


Nope. IIRC it's only KHTML, Gecko and Opera 6+ (perhaps 5.1x?) that do.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jul 23 '05 #15
Toby Inkster wrote:
Mark Parnell wrote:
Does IE Mac support :hover on elements other than <a>?


Nope. IIRC it's only KHTML, Gecko and Opera 6+
(perhaps 5.1x?) that do.


How does Mac IE get on with VBScirpt? If it can understand it then maybe
a VBScirpt implementation would be successfully ignored by all non-IE
browsers. Or VBScript being used to write the script tags into the page
(so it wouldn't happen on non-IE browsers).

Or maybe specifying the language type as "text/jscript" would be enough
to keep non-IE browsers from attempting to load/use the external JS
file.

Richard.
Jul 23 '05 #16

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

Similar topics

13
by: Mikko Ohtamaa | last post by:
From XML specification: The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (This means that <foo></foo> is equal to...
5
by: Lilou | last post by:
Hello this page works : http://lilou.leuwen.chez.tiscali.fr/testlilou.htm the source : .... a.link:hover div.test2 {display : block; position: absolute; z-index: 1000;
5
by: hibernate | last post by:
I'm somewhat new to javascript/DHTML, and this problem has been plaguing me. I have made an 'array' of <div> tags within my html document like so: <div id="menu"> menu1 </div> <div id="menu">...
3
by: Andy Dingley | last post by:
Imagine the XHTML "definition list" structure <dl> <dt>A</dt> <dd>a</dd> <dt>B</dt> <dd>b1</dd> <dd>b2</dd>
1
by: jasonchan | last post by:
How do you align <ol> and <ul> elements when they are contained in a floated box? Here is my website: http://geocities.com/jasonchan483/ Here's my problem. The markers of the lists are...
8
by: cms-hispano.org | last post by:
i'm building a site about extreme accessibility, i.e.: how (and why) to get sites to become fully accessible, *beyond* W3C Web Accessibility Initiative guidelines. it's far from being completed (i...
4
by: plumba | last post by:
Let me explain.... I have a form (most of which you guys have helped me with!!). The initial problem I was having is that it was holding the data in the fields after submit, I resolved this by...
5
by: BobRoyAce | last post by:
There is a web page that has a bunch of links on it (i.e. "<A HREF=..."). I am trying to automate clicking on one in a WebBrowser control. However when I execute the following code: Dim...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.