[thelist] getElementBy Class?
Christian Heilmann
lists at onlinetools.org
Wed Mar 16 17:58:28 CST 2005
Rachell wrote:
>(I know ya'all are probably getting sick of me, but I can't help it -- I
>keep running into stumbling blocks left and right and you guys have been my
>savoirs!)
>
>I was using this javascript to make my Div ID mouseovers work.
>
>function show(object) {
> if (document.getElementById && document.getElementById(object) != null)
> node = document.getElementById(object).style.visibility='visible';
> else if (document.layers && document.layers[object] != null)
> document.layers[object].visibility = 'visible';
> else if (document.all)
> document.all[object].style.visibility = 'visible';
>}
>
>function hide(object) {
> if (document.getElementById && document.getElementById(object) != null)
> node = document.getElementById(object).style.visibility='hidden';
> else if (document.layers && document.layers[object] != null)
> document.layers[object].visibility = 'hidden';
> else if (document.all)
> document.all[object].style.visibility = 'hidden';
>}
>
>but I want to use getElementByClass instead of ID. I've tried various
>different ways to make it work, but knowing so little of javascript, nothing
>has -- does anyone know what changes need to be done to this script to make
>the mouseovers on this page work?
>http://www.kingestate.com/newdesign/Domaine/Estate/Gardens-test.htm
>
>
The main problem is your markup. Instead of using a nested list, which
would make the whole effort a lot easier, you use divs which are not
nested and are hard to reach even with DOM and JavaScript.
With the correct markup, a script creating this effect is rather easy:
http://www.onlinetools.org/tests/mysterymeat.html
I am not too sure about the logic of a navigation going upward, though,
looks to me a lot like Mystery Meat:
http://www.webpagesthatsuck.com/mysterymeatnavigation.html
More information about the thelist
mailing list