View Full Version : Need help to "simplify" a script!!!

10-12-2006, 09:03 AM
Hey Guys

I currently use the script thats on www.lagerhaus.se (look in source code and check for the javascript) I havent built it so I have no idea how to extract unessecary stuff like onload (Does anyone really use it anymore?)

Everytime I shall add stuff i must tel lthe script wich div's who should be shown and wich should be hidden like this

<a href="#" onClick="MM_showHideLayers('info','','hide','bild01','','show','bild02'">

and this is starting to take to much time. What I want to know is if there are any other way to do this, maybe like
<a href="#" onClick="MM_showHideLayers('info','','show','*','','hide'> so It's hide all the other divs (since the divs are at the same place Z-index won't do the trick here)

Can anyone please post some code that I can use or point me to a new script that does the same thing but easier?

Thanks in advance


10-12-2006, 02:17 PM
you can set a javascript variable such as
var showing = 'info';

and when you swap your layer, change the showing var to the one you want to show, and at the same time, hide the current value of showing:

function MM_showHideLayers(id){
document.getElementById(showing).style.display = 'none';
document.getElementById(id).style.display = '';
showing = id;

10-12-2006, 07:56 PM
You coulden't be so kind as to paste a .html page with the script intergated since I'm not a good coder (I know how to change some varibles and to copy and paste) good at coding. I just want some dummy file so i can add myself then.

Thanks in advance!


10-16-2006, 03:10 PM
Please? anyone?