Avatar billede crapmaster Nybegynder
19. december 2005 - 16:42 Der er 3 kommentarer og
1 løsning

Hjælp til Switch Content script II

hej allesammen!"

jeg sider med denne her ´ting som kan gå op og ned, er der ikke en der kan hjælpe mig at den skal være slået sammen når man opper siden, man skal ikke kunne se hvad der er i den før man trykker på den...

KODE:

<html>
<head>
<style type="text/css">
.showstate{ /*Definition for state toggling image */
cursor:hand;
cursor:pointer;
float: right;
margin-top: 2px;
margin-right: 3px;
}
.headers{
width: 400px;
font-size: 100%;
font-weight: bold;
border: 0px solid black;
background-color: lightwight;
}
.switchcontent{
border-left:0px solid black; border-right:0px solid black; border-top:0px solid black; border-bottom:0px solid black; width: 400px;
}
</style>
<script type="text/javascript">

/***********************************************
* ccc- © 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="on" //Enable saving state of content structure using session cookies? (on/off)
var memoryduration="100" //persistence in # of days

var contractsymbol='images/minus.gif' //Path to image to represent contract state.
var expandsymbol='images/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[i].className==classname)
temparray[inc++]=rootobj[i]
}
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[i]).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=="off" && 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>


<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Ulrich Vædelund</title>
</head>

<body>


<div align="center">
  <center>


<table border="0" cellpadding="0" cellspacing="0" style="border-width:0; border-collapse: collapse" bordercolor="#111111" width="44%">
  <tr>
    <td width="100%" style="border-style: none; border-width: medium"><center>
<!--Optional Expand/ Contact All links. Remove if desired-->


</center>
<div class="headers">
  <p align="left">
  <img src="minus.gif" class="showstate" onClick="expandcontent(this, 'sc1')" width="13" height="13" /><font size="2">Ledelsen</font></div>
    <center>
<div id="sc1" class="switchcontent"> 
  <table id="table1" width="377" border="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0" height="172">
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" height="16">
      <b><font face="Verdana" size="1">Ulrich Vædelund</font></b></td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" colspan="2" height="16">
      <div align="left">
&nbsp;</div>
      </td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" rowspan="5" valign="top" height="68">
      <b><font face="Verdana" size="1">
      <img border="1" src="images/489H0157.jpg" width="118" height="87"></font></b></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <p align="left"><font face="Verdana" size="1">Titel:</font></td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <p align="left"><font face="Verdana" color="#000000" size="1">Adm.
      direktør</font></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="1" valign="middle">
      <p align="left"><font face="Verdana" color="#000000" size="1">Mail:</font></td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="1" valign="middle">
      <p align="left"><font face="Verdana" color="#0000cc" size="1">
      <font color="#000000">uvl</font><a href="mailto:uvl@mobiyoung.com" style="text-decoration: none"><font color="#000000"><span style="text-decoration: none">@mobiyoung.com</span></font></a></font></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <font face="Verdana" color="#000000" size="1">Mobil:</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <a href="mailto:uvl@mobiyoung.com" style="text-decoration: none">
      <font face="Verdana" size="1" color="#000000">+45 xx xx xx</font></a></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <font size="1" face="Verdana">Firma tlf.</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <font size="1" face="Verdana">+45 xx xx xx</font></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" height="20" valign="middle" colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" height="12">
      <font face="Verdana" color="#000000" size="1">&nbsp;</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" height="12" valign="middle" colspan="2">
      </td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" height="16">
      </td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" colspan="2" height="16">
      <div align="left">
&nbsp;</div>
      </td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" rowspan="5" valign="top" height="68">
      &nbsp;</td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <p align="left"><font face="Verdana" size="1">Titel:</font></td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <p align="left">&nbsp;</td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="1" valign="middle">
      <p align="left"><font face="Verdana" color="#000000" size="1">Mail:</font></td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="1" valign="middle">
      <p align="left"><font color="#000000" face="Verdana" size="1">
      <a style="text-decoration: none" href="mailto:uvl@mobiyoung.com"><span style="text-decoration: none">
      <font color="#000000">@mobiyoung.com</font></span></a></font></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <font face="Verdana" color="#000000" size="1">Mobil:</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <a href="mailto:uvl@mobiyoung.com" style="text-decoration: none">
      <font face="Verdana" size="1" color="#000000">+45 xx xx xx</font></a></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <font size="1" face="Verdana">Firma tlf.</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <font size="1" face="Verdana">+45 xx xx xx</font></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" height="20" valign="middle" colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" height="12">
      <font face="Verdana" color="#000000" size="1">&nbsp;</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" height="12" valign="middle" colspan="2">
      </td>
    </tr>
  </table>
  </div>
<br />


</center>

<div class="headers">
  <p align="left">
  <img src="minus.gif" class="showstate" onClick="expandcontent(this, 'sc2')" width="13" height="13" /><font size="2">Personale</font></div>
<center>
<div id="sc2" class="switchcontent">

<table id="table1" width="377" border="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0" height="172">
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" height="16">
      <b><font face="Verdana" size="1">Charlotte Andersen</font></b></td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" colspan="2" height="16">
      <div align="left">
&nbsp;</div>
      </td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" rowspan="5" valign="top" height="68">
      &nbsp;</td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <p align="left"><font face="Verdana" size="1">Titel:</font></td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <p align="left"><font face="Verdana" size="1">Personale Chef</font></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="1" valign="middle">
      <p align="left"><font face="Verdana" color="#000000" size="1">Mail:</font></td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="1" valign="middle">
      <p align="left"><font face="Verdana" size="1">Webmaster</font><font face="Verdana" color="#0000cc" size="1"><a href="mailto:uvl@mobiyoung.com" style="text-decoration: none"><font color="#000000"><span style="text-decoration: none">@mobiyoung.com</span></font></a></font></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <font face="Verdana" color="#000000" size="1">Mobil:</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <a href="mailto:uvl@mobiyoung.com" style="text-decoration: none">
      <font face="Verdana" size="1" color="#000000">+45 61 12 65 63</font></a></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <font size="1" face="Verdana">Firma tlf.</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <font size="1" face="Verdana">+45 xx xx xx</font></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" height="20" valign="middle" colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" height="12">
      <font face="Verdana" color="#000000" size="1">&nbsp;</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" height="12" valign="middle" colspan="2">
      </td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" height="16">
      <b><font face="Verdana" size="1">Palle Binderkrantz</font></b></td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" colspan="2" height="16">
      <div align="left">
&nbsp;</div>
      </td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" rowspan="5" valign="top" height="68">
      &nbsp;</td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <p align="left"><font face="Verdana" size="1">Titel:</font></td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <p align="left"><font face="Verdana" color="#000000" size="1">It ansvarlig </font></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="1" valign="middle">
      <p align="left"><font face="Verdana" color="#000000" size="1">Mail:</font></td>
      <td align="right" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="1" valign="middle">
      <p align="left">
      <a href="mailto:uvl@mobiyoung.com" style="text-decoration: none">
      <font face="Verdana" size="1" color="#000000">webmaster</font></a><font face="Verdana" color="#0000cc" size="1"><a href="mailto:uvl@mobiyoung.com" style="text-decoration: none"><font color="#000000"><span style="text-decoration: none">@mobiyoung.com</span></font></a></font></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <font face="Verdana" color="#000000" size="1">Mobil:</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <a href="mailto:uvl@mobiyoung.com" style="text-decoration: none">
      <font face="Verdana" size="1" color="#000000">+45 xx xx xx</font></a></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="55" height="19" valign="middle">
      <font size="1" face="Verdana">Firma tlf.</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="189" height="19" valign="middle">
      <font size="1" face="Verdana">+45 xx xx xx</font></td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" height="20" valign="middle" colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="133" height="12">
      <font face="Verdana" color="#000000" size="1">&nbsp;</font></td>
      <td align="left" style="font-size: 12pt; font-family: 'times new roman', times, serif" width="244" height="12" valign="middle" colspan="2">
      </td>
    </tr>
  </table>
 


</div>
<br />

<table border="0" cellspacing="0" cellpadding="0">
  <tr><td class="headers">
    <img src="images/plus.gif" class="showstate" onClick="expandcontent(this, 'sc3')" width="13" height="13" /><font size="2">Andet</font></td></tr>
  <tr><td id="sc3" class="switchcontent">&nbsp;</td></tr>
</table>
</td>
  </tr>
</table>
  </center>
  </div>
</body>
</html>
Avatar billede psykochicken Nybegynder
19. december 2005 - 23:37 #1
Prøv at tilføje style="display:none;" til de elementer, der skal være skjult fra start.
Ex:
<div id="sc1" class="switchcontent" style="display:none;"> 
og
<div id="sc2" class="switchcontent" style="display:none;">

/psc
Avatar billede crapmaster Nybegynder
20. december 2005 - 19:48 #2
Det var hvad der skulle til, tak skal du have min ven,,,,,

Smid lige et svar
Avatar billede psykochicken Nybegynder
21. december 2005 - 10:54 #3
...svar kommer her ;o)
Avatar billede crapmaster Nybegynder
22. december 2005 - 07:18 #4
//LUKKER
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester