"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