Warnung: file_put_contents(/home/www/web1/html/php_dev/test.txt) [function.file-put-contents]: failed to open stream: Permission denied in /home/www/web1/html/php_dev/sys/lib.activity.php (Zeile 58)
toggle - > expand / collapse [Archiv] - PHP-Scripte PHP-Tutorials PHP-Jobs und vieles mehr

- Ad -
php-resource




Archiv verlassen und diese Seite im Standarddesign anzeigen :
toggle - > expand / collapse


 
bastian
12-08-2004, 13:57 
 
hallo,
habe hier folgendes toggle-script: (keine ahnung wie man das nennt)

wenn man auf "expand 1" klickt, erscheint tabelle1,
klickt man auf "expand 2", erscheint tabelle 2.

möchte nun, das wenn tabelle 1 zu sehen ist , tabelle 2 aber nicht,
und auf "expand 2" klickt, das tabelle 1 verschwindet und tabelle 2 erscheint.

jemand eine idee, wie ichs angehen könnte?


<html>
<head>
<title> tabletest </title>
<script>
function expand(sec)
{
thisSec = eval('e' + sec);
if (thisSec != null){
if (thisSec.length){
if (thisSec[0].style.display != 'none'){
for (var i=0;i<thisSec.length;i++) {thisSec[i].style.display = 'none'}
}
else{
for (var i=0;i<thisSec.length;i++) {thisSec[i].style.display = 'inline'}
}
}
else{
if (thisSec.style.display != 'none') {thisSec.style.display = 'none'}
else{thisSec.style.display = 'inline'}
}
}

}
</script>


</head>

<body>
<table width="500" height="55" border="0" align="center" cellpadding="0" cellspacing="5" bgcolor="#666666">
<tr>
<td><p><a href="javascript:expand(0)">+expand1</a> - <a href="javascript:expand(1)">+expand2</a></p></td>
</tr>
</table>

<!-- TABELLE A -->
<div id="e0" style="display:none">
<center><img src="spacer.gif" width="1" height="1"></center>
<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#666666"align="center" >
<tr>
<td>form1 - <a href="javascript:expand(0)">toggle 1</a></td>
</tr>
</table>
</table>
</div>
<!-- TABELLE A ENDE -->

<!-- TABELLE B START -->
<div id="e1" style="display:none">
<center><img src="spacer.gif" width="1" height="1"></center>
<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#666666"align="center" >
<tr>
<td>form2</td>
</tr>
</table>
</table>
</div>
<!-- TABELLE B ENDE -->
<center><img src="spacer.gif" width="1" height="1"></center>
<table width="500" height="146" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#999999">
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

 
derHund
12-08-2004, 14:20 
 
collapse einfach vor jeder aktion alles?

hattest dir das so vorgestellt?

 
wahsaga
12-08-2004, 14:21 
 
Original geschrieben von bastian
möchte nun, das wenn tabelle 1 zu sehen ist , tabelle 2 aber nicht,
und auf "expand 2" klickt, das tabelle 1 verschwindet und tabelle 2 erscheint.

jemand eine idee, wie ichs angehen könnte?
merke dir vorher, ob tabelle eins sichtbar ist oder nicht - oder frage es zu dem zeitpunkt, wo du tabelle zwei "toggeln" willst, ab.

 
bastian
12-08-2004, 14:44 
 
ok, gehts bitte auch etwas beispielhafter.
js ist noch weniger meine stärke als php :-)

gruss und danke für die antworten
bastian

 
wahsaga
12-08-2004, 14:59 
 
Original geschrieben von bastian
ok, gehts bitte auch etwas beispielhafter.
nein, noch beispielhafter wäre schon die fertige lösung.
und solche servieren wir hier nur ungern, du willst ja auch selber was dabei lernen.

js ist noch weniger meine stärke als php :-)
dann sieh zu, dass du stärker darin wirst.

http://de.selfhtml.org/javascript/ empfängt auch dich mit offenen armen ...

 
derHund
12-08-2004, 15:05 
 
hmm,

hat ja imho mit der programmiersprache an sich nix zu tun, es geht ja eher ums prinzip ...

schließe alle tabellen, und öffne die, die geöffnet werden soll

oder halt wahsagas methode, nimmt sich nicht viel ...

 
bastian
12-08-2004, 15:37 
 
jupp, hab schon diverse und teils fiese threads zum thema "fertige lösungen servieren" gelesen und definitiv wollte ich keine fertige lösung innen arsch geblasen bekommen.

bemüh mich das ding hinzubekommen,
danke für eure hilfe.

gruss
bastian


Alle Zeitangaben in WEZ +2. Es ist jetzt 19:52 Uhr.