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 10 of 10
  1. #1
    mtd
    mtd is offline
    Regular Coder
    Join Date
    Jun 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IE/NS Compatable Link Descriptions?

    I am looking for a script that is compatable with Internet Explorer (not a problem) and Netscape (this is where the problem comes in). Basically, onMouseover a link should create a small text description somewhere else on the page (see http://simplythebest.net/scripts/dhtml_script_85.html for example). This works fine in IE, but as predicted nothing happens in NS.

    I have tried making adjustments, searching for different scripts, etc, but to no avail. I was hoping someone would have a suggestion or two on what to do about this....

    Thanks in advance!
    Matt

  • #2
    Regular Coder
    Join Date
    Oct 2003
    Location
    SC
    Posts
    936
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Two things i have to say:

    1. It is never NS that makes the truble with scripts, cause when u follow the W3C standarts then it WILL work in NS, but not always in IE, it is IE that makes truble when u create scripts (grrr).
    2. I really would NOT use js for this, instead just use CSS

    here try this:

    <head>
    <style>
    a span{
    display: none;
    }

    a:hover span{
    display: block;
    position: absolute;
    top: 50px;
    }
    </style>
    </head>
    <body>
    <a href=#>Click here<span>Cant see me</span></a>
    <a href=#>Or here<span>Something else</span></a>
    <a href=#>But not here<span>Hoooha soo cool</span></a>
    </body>

    that just was a very very simple working example (do NOT try to make it more complex, you will go insane over it, cuz u will do everyting right and then finally u realize that the browser does not support COMPLEX css selectors [happened to me])

    have fun coding

  • #3
    mtd
    mtd is offline
    Regular Coder
    Join Date
    Jun 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for the quick reply! unfortunately, the css works in NS but not IE. seems like it is one or the other!

    also, i realize that ns follows standards and ie does not, but ie is still the most widely used (unfortunately), so I need to design with that in mind.

    if you (or anyone else) have more suggestions, I'd be grateful. I am really stuck here.

    thanks

  • #4
    Regular Coder
    Join Date
    Oct 2003
    Location
    SC
    Posts
    936
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I do not know what you mean, the code works just fine in IE atleast on my pc, but maybe you can attache a zip file with all the files of ur webpage and the css layout so that i can take a look at it

  • #5
    mtd
    mtd is offline
    Regular Coder
    Join Date
    Jun 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That is just it - I didn't integrate it into my site...i just created a blank html page with just the code you provided. Worked fine in NS, but in IE the <span> hidden code did not appear.

    Maybe a version difference? I have IE 6, do you?

    Thanks for your help so far. Is it even possible to do this in javascript?

  • #6
    Regular Coder
    Join Date
    Oct 2003
    Location
    SC
    Posts
    936
    Thanks
    0
    Thanked 0 Times in 0 Posts
    lol, im so sorry ( I was looking at a diferent code [not urs], and it worked jsut fine in IE, lol but the css now also works in IE)

    IE sometimes needs a little help understanding CSS



    Well, remeber when I said that it is IE that makes all the truble?

    anyways, here it is :

    <head>
    <style>
    a span{
    display: none;
    }

    a:hover{
    border: 0px;
    }

    a:hover span{
    display: block;
    position: absolute;
    top: 50px;
    left: 0px;
    }
    </style>
    </head>
    <body>
    <a href=#>Click here<span>Cant see me</span></a>
    <a href=#>Or here<span>Something else</span></a>
    <a href=#>But not here<span>Hoooha soo cool</span></a>
    </body>

    It did not work in IE because when i tired to read the a:hover span, we never defined a a:hover state so it just decides to stop then (stupid IE)

    BTW: I hope u dont use IE
    (Even tho 98% of internet users use IE, grrrr)


    Ahhh, another edit (my third one ), yes yes, it is possible in JS, but why do all that truble if it is so much easier in CSS?
    Last edited by JAVAEOC; 03-11-2004 at 07:49 PM.

  • #7
    mtd
    mtd is offline
    Regular Coder
    Join Date
    Jun 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the help!

    Now it works in both. You are right, IE is pretty bad when it comes to following the rules. And I personally like to use NS.

    I am still stuck though. I probably should have made this more clear in the beginning.... The reason I asked about Javascript is I need the link descriptions to stay in place even when the mouse is not hovering over the link any more. (onMouseover / onMouseout). For example, in the script I linked to in my first post, one could just remover the onmouseout instance in each link and that would cause the description to stay in place until another description is called.

    With CSS, I cannot see any way of doing this. This is why Javascript is probably better for what I am looking for.

    Matt
    Last edited by mtd; 03-11-2004 at 10:59 PM.

  • #8
    Regular Coder
    Join Date
    Oct 2003
    Location
    SC
    Posts
    936
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ahh, i see what you want... This post will be edited shortly with a script to it

    have fun
    Code:
    <html>
    <style>
    span{
    	display: none;
    	position: absolute;
    	top: 30;
    	left: 20;
    	}
    </style>
    <head>
    <script>
    var num=3;
    function show(id){
    			for(i=0; i<num; i++){document.getElementById(i).style.display="none"}
    			document.getElementById(id).style.display="block";
    			}
    </script>
    </head>
    <body>
    <a onmouseover="show('0')" href="#">111111111111</a><span id="0">!!!!!!!!!!!!!</span>
    <a onmouseover="show('1')" href="#">222222222222</a><span id="1">@@@@@@@@@@@@@</span>
    <a onmouseover="show('2')" href="#">333333333333</a><span id="2">#############</span>
    </body>
    </html>
    ________________________________

    all you have to do is chage the variable called num to the total amount of spans... then give all of ur spans and id start at 0, 1, 2... and ur finished
    Last edited by JAVAEOC; 03-11-2004 at 11:32 PM.

  • #9
    mtd
    mtd is offline
    Regular Coder
    Join Date
    Jun 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you SOOO much! that is exactly what I needed, and it works perfectly!

    I am glad that there are people like you who will take time out of their day to help a beginner. Thank you so very much.

    Matt

  • #10
    Regular Coder
    Join Date
    Oct 2003
    Location
    SC
    Posts
    936
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I started just like you, and I really would not have continued js if there wouldnt be other ppl "like me", so i hope that you will soon be able to help other beginners

    js is soooo much fun once you are really in to it

    have fun coding


  •  

    Posting Permissions

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