PDA

View Full Version : bratta's showHide script related question


flashnurde
16.05.2001, 18:36
hey everybody,
first of all please excuse if my question might sound too rookie like to you guys... my question as you might guess is related to the showHide script which can be found under http://www.bratta.com/dhtml/scripts.asp?url=scripts/scripts.asp?id=1&ac=23&order=created i am using the regular show/hide option so far everything works out just fine. now though i was attempting to use the script in combination with about 10-15 div layers... they should all be positioned on top of each other and the respective layer should be shown if a link as been clicked... of course only one div should be revealed at the same time which means that if another div is about to be revealed i would first have to hide the previously selected div... so basically, i would have to make some adjustment within the following functions:
<pre id=code><font face=courier size=2 id=code> //Shows the div
function show(div,nest){
obj=bw.dom?document.getElementById(div).style:bw.i e4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
obj.visibility='visible'
}
//Hides the div
function hide(div,nest){
obj=bw.dom?document.getElementById(div).style:bw.i e4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
obj.visibility='hidden'
} </font id=code></pre id=code>]
my problem now though is that i am not too sure about how to best go about this issue... any suggestions/comments would be highly appreciated maybe even suggestions on how to solve it in a different way, i dont know? since i am coming more from the Actionscripting area i just started messing around with JS more.. since now it all starts to make more sense to me after all that is :) i guess my solution is not a very professional one having all div layers loaded even though maybe not all are being requested by the user... the reason for doing so was because i did not want to reload the complete page instead i just wanted to "reload" a layer with new content, because of that i was testing the iframe solution... that though didnt really work for me because they wont allow content to "shine" through... soo hmmm as u can see i sound a little lost hehe thanx a lot chris

http://www.2-obvious.co.uk
http://www.formrecording.com
http://www.meridianspa.de
http://www.ck-design.com

Dan
16.05.2001, 19:07
Ok ... how about this strategy:
1. Have all your DIVs positioned as you want, in the same place.
2. Set all of them to "visiblity: hidden" except the one that shows at the start.
3. Use a function such as the one below that hides all the layers, then shows the one you want.

e.g:
<pre id=code><font face=courier size=2 id=code>
function showDiv(divNum,nest) {
for(i=0;i<=numDivs;i++) hide('div'+i,nest);
show('div' + divNum, nest);
}</font id=code></pre id=code><pre id=code><font face=courier size=2 id=code>//... Insert Bratta's ShowHide functions here ...\</font id=code></pre id=code>

this is just to give you an idea ( I haven't tested it, and it assumes the layers are called 'div0', 'div1' etc.

Hope this helps

<font face='Tahoma'>======================
Dan
www.pupius.net
======================
</font id='Tahoma'>

Edited by - Dan on 05/16/2001 18:11:04

Shane
16.05.2001, 19:27
Hmmm....that is a really good idea Dan.

ShAnE

Dan
16.05.2001, 19:30
Ta <img src=icon_smile_big.gif border=0 align=middle>

<font face='Tahoma'>======================
Dan
www.pupius.net
======================
</font id='Tahoma'>

flashnurde
16.05.2001, 19:58
<BLOCKQUOTE id=quote><font size=1 face="Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Ta <img src=icon_smile_big.gif border=0 align=middle>

<font face='Tahoma'>======================
Dan
www.pupius.net
======================
</font id='Tahoma'>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Arial, Helvetica" size=2 id=quote>
ohhh yeah that looks quite promising so i'll give a shot now unless i don't fall asleep before...
chris

http://www.2-obvious.co.uk
http://www.formrecording.com
http://www.meridianspa.de
http://www.ck-design.com

flashnurde
16.05.2001, 20:55
just tested it on NS4+ and IE
and it works perfectly thanks a lot
chris

http://www.2-obvious.co.uk
http://www.formrecording.com
http://www.meridianspa.de
http://www.ck-design.com

Rod
18.05.2001, 07:56
Welcome to DHTMLCentral Chris. =)

Rad
[url="http://www.e-syed.net/viewsrc"]viewsrc[/url:qkt6v9tn59]