Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Banned
    Join Date
    Mar 2003
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    onmouseover: glow

    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

  • #2
    New Coder
    Join Date
    Mar 2003
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try the following, but it only works in IE.

    Code:
    <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=.

  • #3
    Banned
    Join Date
    Mar 2003
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    New Coder
    Join Date
    Mar 2003
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah filters are Win/IE proprietary; to prevent errors you have to do something like

    if(obj.filters) { obj.filters ...
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #6
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Mattover-matter: you could always download Opera 7 and Mozilla - they are both for free. (Though Opera is ad sponsored.)
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #7
    Banned
    Join Date
    Mar 2003
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •