Paul Davis said the following on 7/26/2006 2:35 PM:
Quote:
First, quote the values in the links.
No, first you quote what you are replying to.
Quote:
change this:
<a onmouseover="doStuff(monaco)">Monaco</a><br />
to this:
<a onmouseover="doStuff('monaco')">Monaco</a><br />
OK, not sure I agree but ok.
Quote:
Next, use getElementById as a method:
There is no other way to use it.....
Quote:
document.getElementById.el.style.display="block";
becomes:
document.getElementById(el).style.display="block";
>
Your el.mouseout is completely broken but, with good intentions. delete
that.
I'm going to recommend that you do the following:
Don't.
Quote:
make your links like this:
<a onmouseover="show('monaco')"
onmouseout="hide('monaco')">Monaco</a><br />
and use some js like this:
function show(name){
document.all.tubimage.src=name+".jpg";
And then wonder why it only works in IE?
Besides, don't use document.all or gEBI to access an image, use the
Images collection:
document.images['tubimage'].src = name + ".jpg";
Quote:
document.getElementById(name).style.display="block ";
}
function hide(name){
document.all.tubimage.src="monaco.jpg";
Ditto.
Quote:
document.getElementById(name).style.display="none" ;
}
>
There are some better ways to do this but,
There are more better ways to do it than worse ways to do it than the
way you did it.
Quote:
it looks like you are still getting started.
Then now is the time to teach good habits, not to say "You are just
getting started so here are some bad habits for you.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/