...

View Full Version : onmouseover: glow



mattover-matter
04-05-2003, 04:32 PM
I found this at wschools

<html>
<head>
<style>
a
{
color:black;
width:150;
font:bold;
}
</style>

<script type="text/javascript">
var i
function glow()
{
i=0
interval=setInterval("makeglow(myLink)",10)
}

function back()
{
clearInterval(interval)
myLink.style.filter=false
}

function makeglow()
{
i++
if (i<5)
{
myLink.style.filter="glow(color=#FF00FF,strength=" + i + ")"
}
else if (window.interval)
{
clearInterval(interval)
}
}

</script></head>

<body>
<a href="default.asp" id="myLink" onmouseover="glow()" onmouseout="back()">Mouse over this link</a>
</body>

</html>



How can I apply it to all links?

like:

this.style.filter

or something

eggman
04-05-2003, 05:24 PM
Try the following, but it only works in IE.



<html>
<head>
<style>
a{color:black;width:150;font:bold;}
</style>
<script type=text/javascript>
var obj
var i
function glow()
{
obj=this
i=0
interval=setInterval("makeglow()",10)
}
function back()
{
clearInterval(interval)
obj.style.filter=false
}
function makeglow()
{
i++
if (i<5)
{
obj.style.filter="glow(color=#FF00FF,strength=" + i + ")"
}
else if (window.interval)
{
clearInterval(interval)
}
}
</script>
</head>
<body>
<a id=test1>Mouse over this link</a>
<a id=test2>Mouse over this link</a>
<a id=test3>Mouse over this link</a>
<script>
var links=window.document.anchors
for(var i in links)
{
links[i].onmouseover=glow
links[i].onmouseout=back
}
</script>
</body>
</html>


The links must have an id= or name=.

mattover-matter
04-05-2003, 09:52 PM
thanks. Doesn't the other one work only in ie?

If in a non ie browser, will it just not do anything? Sorry, ie only browser I got

eggman
04-06-2003, 07:25 PM
Sorry, what I meant is that filters are proprietary IE. I'm not sure what other browsers will do, but I'm guessing they will error with the Javascript references. I don't know which browsers support the style object. The anchors collection is also an IE thing.

brothercake
04-06-2003, 07:51 PM
Yeah filters are Win/IE proprietary; to prevent errors you have to do something like

if(obj.filters) { obj.filters ...

liorean
04-06-2003, 08:06 PM
Mattover-matter: you could always download Opera 7 (http://www.opera.com/download/) and Mozilla (http://www.mozilla.org/releases/) - they are both for free. (Though Opera is ad sponsored.)

mattover-matter
04-18-2003, 01:16 AM
well, unfortunately..this is not my computer and would probably get in trouble. Would this override any ie thing? Just like a different "internet explorer" icon to open in different browser?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum