Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > add window.status javascript to a:hover css pseudo-class?

Reply
Thread Tools

add window.status javascript to a:hover css pseudo-class?

 
 
Bob P.
Guest
Posts: n/a
 
      06-25-2004
Hi, basically what I'd like to do is suppress the action that causes
the URL to show up in the browser status bar when I roll over a
hyperlink. I know I could use the onmouseover event in each anchor
tag, but I'd rather be able to do it globally thru my stylesheet,
rather than having to futz with each link. Does anyone know a
solution for this? It seems like you could maybe add quick
window.status='blah' javascript or something to the a:hover
pseudoclass to control status bar behavior. Thanks.
 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      06-25-2004
Bob P. wrote:
> Hi, basically what I'd like to do is suppress the action that causes
> the URL to show up in the browser status bar when I roll over a
> hyperlink. [...]


No, you don't want to mess with the UA of your visitors.


PointedEars
 
Reply With Quote
 
 
 
 
Grant Wagner
Guest
Posts: n/a
 
      06-25-2004
"Bob P." wrote:

> Hi, basically what I'd like to do is suppress the action that causes
> the URL to show up in the browser status bar when I roll over a
> hyperlink. I know I could use the onmouseover event in each anchor
> tag, but I'd rather be able to do it globally thru my stylesheet,
> rather than having to futz with each link. Does anyone know a
> solution for this? It seems like you could maybe add quick
> window.status='blah' javascript or something to the a:hover
> pseudoclass to control status bar behavior. Thanks.


No, you can't add Javascript to CSS, at least not in a cross-browser,
cross-platform way (I think IE supports "behaviours" in CSS, but it's
not supported in most other browsers).

Use the following code to set the onmouseover event for every <A> on the
page:

<body onload="setAllHrefOver(returnFalse);">:
<script type="text/javascript">
function returnFalse() { return false; }
function setAllHrefMOver(f, d, inLayer) {
// to minimize page size, rather then defining separate onmouseover
// events for every link on the page, any link without an existing
// onmouseover event is set by this function

if (!inLayer) {
d = document;
}

if (d) {

var i;

if (d.links) {
for (i = 0; i < d.links.length; i++) {
if (!d.links[i].onmouseover) {
d.links[i].onmouseover = f;
}
}
}

if (d.layers) {
for (i = 0; i < d.layers.length; i++) {
setAllHrefMOver(f, d.layers[i].document, true);
}
}
}
} // setAllHrefMOver()
</script>

It just occurred to me you could use the "d" parameter to determine if
you're in a layer or not, you don't really need the "inLayer" indicator.
I'm not sure why I did that way, I think I wanted to be explicit about
when the function has been called recursively.

Note also that this function could be modified to either be passed the
event, or you could make a copy of the function for the onmouseout or
other events. You can also use it to assign events to other elements at
run-time. If you want to use it for elements other then <A>, you'll want
to investigate whether recursing into layers is required.

--
| Grant Wagner <>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS to javascript - CSS events are too slow. mjpdatadev@yahoo.com Javascript 7 07-11-2007 07:32 PM
add javascript to css image gallery kaizer bo Javascript 2 07-19-2006 04:34 PM
CSS Layout question - how to duplicate a table layout with CSS Eric ASP .Net 4 12-24-2004 04:54 PM
CSS Property changes via Javascript trashes CSS print version Julie Siebel Javascript 4 02-25-2004 01:29 PM
print.css and screen.css tom watson HTML 1 09-09-2003 02:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57