Topic awaiting preservation: Hide/Show Layers with 'Next' and 'Previous' buttons???? URGENT HELP NEEDED!! (Page 1 of 1) |
|
---|---|
Neurotic (0) Inmate Newly admitted From: |
posted 08-24-2005 22:41
I have this project that needs to be finished within 3 days and I'm desperate. |
Bipolar (III) Inmate From: f(x) |
posted 08-24-2005 22:43 |
Obsessive-Compulsive (I) Inmate From: |
posted 08-24-2005 22:53
yes. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 08-24-2005 23:16
Control as in make visible and invisible? code: <!-- HTML --> <body onload="init();"> <a href="" onclick="prev(); return false;">previous</a> <a href="" onclick="next(); return false;">next</a> <div id="layer0" class="hideshowlayer">...</div> <div id="layer1" class="hideshowlayer">...</div> <div id="layer2" class="hideshowlayer">...</div> ... // CSS // (make all layers start off invisible) .hideshowlayer {display:none;} // JavaScript var curlayer = 0; var numlayers = 3; // set this appropriately var layers = new Array(); function init() { for (var i = 0; i < numlayers; ++i) { layers[i] = document.getElementById("layer" + i); } layers[curlayer].style.display = 'block'; } function prev() { layers[curlayer].style.display = 'none'; --curlayer; if (curlayer < 0) curlayer = 0; layers[curlayer].style.display = 'block'; } function next() { layers[curlayer].style.display = 'none'; ++curlayer; if (curlayer >= numlayers) curlayer = numlayers - 1; layers[curlayer].style.display = 'block'; } |
Paranoid (IV) Inmate From: Florida |
posted 08-25-2005 20:37
If the data isn't too large (therefore not making the page load too great), you can just use CSS. |