Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] link status
- From: javascript@xxxxxxxxxx (Hassan Schroeder)
- Subject: [Javascript] link status
- Date: Tue, 17 Dec 2002 09:02:29 -0800
Cutter (JavaScript) wrote:
> Yes, I want to set a mouseover event for all links on the page. No, I do
> not want to include the mouseover in the link itself. I wanted to know
> if anyone had possibly done something like this using the links[] object
> of the document. Something like (though this doesn't do it...):
>
> <script>
> var d = document;
> for( var i = 0; i < d.links.length; i++ ){
> d.links[i].onmouseover = (window.status = '');
>
> </script>
Assignment to an event handler takes a reference to a function,
so you need something like this:
<script type="text/javascript">
function foo()
{
window.status = "";
return true;
}
function init()
{
var d = document;
for( var i = 0; i < d.links.length; i++ )
{
d.links[i].onmouseover = foo;
}
}
</script>
<body onload="init();">
// Until the page is loaded the links array will be empty , hence
// the running it via onload().
HTH!
--
Hassan Schroeder ----------------------------- hassan@xxxxxxxxxxxxxx
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
- References:
- [Javascript] link status
- From: javascript@xxxxxxxxxx
- [Javascript] link status
- From: Cutter (JavaScript)
- [Javascript] link status
- Prev by Date: [Javascript] link status
- Next by Date: [Javascript] Javascript digest, Vol 1 #458 - 3 msgs
- Previous by thread: [Javascript] link status
- Next by thread: [Javascript] Javascript digest, Vol 1 #458 - 3 msgs
- Index(es):