Select the content that you want open onload and find its activating element. For the first piece of expandable content from the demo that would be:
HTML Code:
<h3 onClick="expandcontent(this, 'sc1')" style="cursor:hand; cursor:pointer"><span class="showstate"></span>What is JavaScript?</h3>
Give it an id say, 'open':
Code:
<h3 id="open" onClick="expandcontent(this, 'sc1')" style="cursor:hand; cursor:pointer"><span class="showstate"></span>What is JavaScript?</h3>
Put this bit of code (highlighted red) at the very end of the function do_onload():
Code:
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" && ccollect.length>0){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0"
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
if (document.getElementById('sc1').style.display!='block')
expandcontent(document.getElementById('open'), 'sc1')
}
If you want to use a different section of expandable content, use its sc# designation and assign the id="open" to its activating element.
Bookmarks