PDA

View Full Version : switchcontent2: hide object first



bobbby
01-15-2006, 04:39 AM
New day, new problem.

I'm using this script:
http://www.dynamicdrive.com/dynamicindex17/switchcontent2.htm

I was wondering if you could change the initial state of the "object" to hidden. Currently the object isnt hidden when the page loads for the first time.

I also tried the "switchcontent 1" script which didnt have that problem, but it was a graphical mess in firefox and opera. "switchcontent 2" works fine in all browsers except for the problem mentioned above...

Twey
01-15-2006, 04:46 AM
Find:

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
if (enablepersist=="on" && get_cookie(window.location.pathname)!="" && ccollect.length>0)
revivecontent()
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}Replace with:

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
if (enablepersist=="on" && get_cookie(window.location.pathname)!="" && ccollect.length>0)
revivecontent()
sweeptoggle("contract");
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}Probably full of mistakes, it's 0445 and I haven't had any sleep.

bobbby
01-15-2006, 05:52 AM
Who needs sleep when you can have so much fun with javascript? :rolleyes:

Your advice worked btw. thanks.

Case closed!

Twey
01-15-2006, 07:07 AM
Who needs sleep when you can have so much fun with javascript?Hur, hur, hur. Qt, actually.