...

View Full Version : IE/NS Compatable Link Descriptions?



mtd
03-10-2004, 10:33 PM
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

JAVAEOC
03-10-2004, 11:14 PM
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 :thumbsup:

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:D])

have fun coding :thumbsup:

mtd
03-10-2004, 11:29 PM
thanks for the quick reply! unfortunately, the css works in NS but not IE. seems like it is one or the other! :mad:

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

JAVAEOC
03-10-2004, 11:39 PM
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 :D

mtd
03-11-2004, 01:31 AM
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?

JAVAEOC
03-11-2004, 06:38 PM
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

:D :D :D :D

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
:thumbsup: (Even tho 98% of internet users use IE, grrrr) :(


Ahhh, another edit (my third one :D), yes yes, it is possible in JS, but why do all that truble if it is so much easier in CSS?

mtd
03-11-2004, 09:55 PM
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

JAVAEOC
03-11-2004, 10:19 PM
ahh, i see what you want... This post will be edited shortly with a script to it :D

have fun

<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 :thumbsup:

mtd
03-11-2004, 10:59 PM
Thank you SOOO much! that is exactly what I needed, and it works perfectly! :D :D :D

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

JAVAEOC
03-11-2004, 11:02 PM
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 :D

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

have fun coding :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum