• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Trying to get this javascript to do something.

VenomXt

Blame me for the RAZR's
#1
www.venomxt.com. (same scrip just cookies for save state are turned on.)

Ok i want to have the user open the web page for the first time and all but the first "post" need to be collapsed... Iv been playing with this scrip for hours. Iv modified it alot from the original i found but i just cant get the damn thing to work.

Its alot of code. If someone really wants to take a deep look i could just post the index.htm file. But here it is.

<head>

<meta http-equiv="Content-Language" content="en-gb" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>

<title>VenomXt Unleashed</title>

<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="menu.css" />


<style type="text/css">

.showstate{ /*Definition for state toggling image */
cursor:hand;
cursor:pointer;
float: right;
margin-top: 2px;
margin-right: 5px;
}

.headers{

border: 0;
background-color: transparent;
}

.switchcontent{
width: 400px;
border: 0;
border-top-width: 0;
}

</style>

<script type="text/javascript">

/***********************************************
* Switch Content script II- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated April 2nd, 2005.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var enablepersist="off" //Enable saving state of content structure using session cookies? (on/off)
var memoryduration="7" //persistence in # of days

var contractsymbol='minus.gif' //Path to image to represent contract state.
var expandsymbol='plus.gif' //Path to image to represent expand state.

/////No need to edit beyond here //////////////////////////

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj.className==classname)
temparray[inc++]=rootobj
}
return temparray
}

function sweeptoggle(ec){
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=(ec=="contract")? "none" : ""
inc++
}
revivestatus()
}


function expandcontent(curobj, cid){
if (ccollect.length>0){
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="none")? "none" : ""
curobj.src=(document.getElementById(cid).style.display=="none")? expandsymbol : contractsymbol
}
}

function revivecontent(){
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents).style.display="none"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="none")
statecollect[inc].src=expandsymbol
else
statecollect[inc].src=contractsymbol
inc++
}
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="none")
selectedItem+=ccollect[inc].id+"|"
inc++
}
if (get_cookie(window.location.pathname)!=selectedItem){ //only update cookie if current states differ from cookie's
var expireDate = new Date()
expireDate.setDate(expireDate.getDate()+parseInt(memoryduration))
document.cookie = window.location.pathname+"="+selectedItem+";path=/;expires=" + expireDate.toGMTString()
}
}

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()
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate

</script>




<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>

<body>



<div id="container">


<!-- menu -->
<div id="menu">
<div id="navcontainer">
<ul id="navlist">
<li id="active"><a title="link one" href="index.html" id="current">Home</a></li>
<li><a title="link two" href="gallery/gallery.htm">Gallery</a></li>
<li><a title="link four" href="recipes.html">Recipes</a></li>
<li><a title="link five" href="login.htm">Files</a></li>
<li><a title="link six" href="fileupload/index.php">Upload</a></li>
<li><a title="link seven" href="aboutme.html">About Me</a></li>
<li><a title="link seven" href="phpBB2/login.php">Forums</a></li>
</ul>
</div>
</div>

<!-- picture header -->
<div id="header"><a title="home" href="index.html"><img alt="header image" src="header.jpg" width="760" height="125" /></a></div>

<!--Optional Expand/ Contact All links. Remove if desired-->
<div style="margin-bottom: 5px"><a href="javascript:sweeptoggle('contract')">Contract All</a> | <a href="javascript:sweeptoggle('expand')">Expand All</a></div>

<!-- main content -->
<div id="content">

<!-- Begin-->
<!-- CONTENT EXAMPLE BELOW-->
<div class="headers"><img src="minus.gif" class="showstate" onClick="expandcontent(this, 'sc9')" />

<div class="titleh1">

<h1> Site Overhaul Almost Done.</h1>
</div>
</div>
<div id="sc9" class="switchcontent">
<h6 align="left">March 23rd</h6>

<p class = "contentlessspace">

Iv Spent the last 13 hours teaching myself how to do alot of java and css. I have finished 3 major aspects od the site. The <a href="gallery/gallery.htm">Gallery</a> has been overhauled completly and now is running on a mixture of .php and xhtml. Its kinda neat i have made it where all I have to do is drop pictures in a folder and it autoupdates the site by itself. Next, I spent alot of time getting the <a href="login.htm">File tab</a> up and running and im now sharing random files. I even spent longer getting a secure login working for it so only a few people out there will be able to get into it. And last but not least i got the <a href="upload/index.php">Upload tab </a>working. With this you can upload pictures to a static folder for me to review and i will put them in the gallery. Eventually i want users to be able to upload pics straight to the gallery but i faile da few times at that tonight and need a break from it. PLEASE I beg of you the 5 people that come to this site try it out i want to see how usful it is and work out any bugs in it. The next thing i really need to start working on is a archive system but not sure how im gona go with that yet. And i just finished the <span class="style1"><a href="phpBB2/login.php">Forum</a>........ <strong>come sign up anyone........</strong></span> please hehe. All right im out for now. Night. </p>
<p class = "contentlessspace"><s>I know there are lots of dead tab links when you get into the pages i will be working on them next, should be a very quick fix.</s> </p>


</div>

<!-- CONTENT EXAMPLE END-->
<!-- END-->

<div class="headers"><img src="minus.gif" class="showstate" onClick="expandcontent(this, 'sc8')" />

<div class="titleh1">

<h1> Riders on the storm.</h1>
</div>
</div>
<div id="sc8" class="switchcontent">
<h6 align="left">March 17th</h6>

<p class = "contentlessspace" align="center">
What must go up eventually comes down then you throw it up with glue.<br> <br>
Riders on the storm <br>
Into this house we’re born <br>
Into this world we’re thrown <br>
Like a dog without a bone <br>
Riders on the storm</p>
</div>

<!-- END-->
 

Members online

No members online now.

Latest posts

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,962
Messages
673,247
Members
89,018
Latest member
debbieherrin