fact: "I laugh at the sight of humans"
BastardDomain Forums \ Development \ div en tabel probleem
div en tabel probleem
Gorgeous George
Opmerk Bastard

Registered: 13 Jul 2001
Location: BehindMy21
Posts: 4748
7 May 2004

ik gebruik een stukje javascript en een div om een menustructuur te maken:
als men op een folder klikt klappen onderliggende links uit (worden visible)
dit werkt, alleen als ik het geheel in een tabel zet dan werkt de folder functionaliteit niet meer.

stukje gebruikt javascript:

<script language="JavaScript" type="text/javascript"><!-- 
function hideShowEl(i,v) {
var sObj = document.getElementById(i).style;
if(sObj.display == "none"smilie sObj.display = v;
else if(sObj.display == v) sObj.display = "none";
}
--></script>

het werkt wel als ik het zo oplos:
<?php
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="#" class="folder" onclick="hideShowEl('id39','inline'); return false;">Folder link</a><br>
<div id="id39" style="display: none">
<a href="http://URLa" target="_blank" title="http://URL" >Link Name1</a><br>
<a href="http://URLa" target="_blank" title="http://URL" >Link Name2</a><br>
<a href="http://URLa" target="_blank" title="http://URL" >Link Name3</a><br>
</div>
&nbsp;<a href="http://URLa" target="_blank" title="http://URLa" >Link Namea</a><br></td>
</tr>
</table>
?>


maar niet als ik het zo oplos:

<?php 
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<table>
<tr><td><a href="#" class="folder" onclick="hideShowEl('id40','inline'); return false;">Folder link</a></td></tr>
<div id="id40" style="display: none">
<tr><td><a href="http://URLa" target="_blank" title="http://URL" >Link Name1</a></td></tr>
<tr><td><a href="http://URLa" target="_blank" title="http://URL" >Link Name2</a></td></tr>
<tr><td><a href="http://URLa" target="_blank" title="http://URL" >Link Name3</a></td></tr>
</div>
</table>
</td>
</tr>
</table>
?>

Waarom werkt de onderstaande manier niet?
en hoe los ik het op?

This post was edited by Gorgeous George at 8 May 2004

Rainman
BMW Bastard

avatar Rainman

Registered: 11 Apr 2001
Location: Everywhere
Posts: 5391
8 May 2004

Het werkt niet om dat je je divje om niet om de tr's mag wrappen


dit werkt wel

<table cellpadding="0" cellspacing="0">
<tr>
<td>
<table>
<tr><td><a href="#" class="folder" onclick="hideShowEl('id40',''); return false;">Folder link</a></td></tr>
</table>
<table id="id40" style="display: none">
<tr><td><a href="http://URLa" target="_blank" title="http://URL" >Link Name1</a></td></tr>
<tr><td><a href="http://URLa" target="_blank" title="http://URL" >Link Name2</a></td></tr>
<tr><td><a href="http://URLa" target="_blank" title="http://URL" >Link Name3</a></td></tr>
</table>
</td>
</tr>
</table>


The only reason that you're conscious right now is because I don't want to carry you. - Jack Bauer
"http($this->addslashes("http://87.233.202.7/stuff/bauer/sig.php")) . "\" border=\"0\" alt=\"[user image]\" />"
Gorgeous George
Opmerk Bastard

Registered: 13 Jul 2001
Location: BehindMy21
Posts: 4748
8 May 2004

thx alot man

alleen bereik ik op deze manier niet wat ik wil bereiken.
Ik wilde namelijk dat 'edit knop' welke achter elke link en map kwam te staan op dezelfde hoogte kwam te staan.

door de door jou voorgestelde tabelstructuur gaat dit niet

This post was edited by Gorgeous George at 8 May 2004

Gorgeous George
Opmerk Bastard

Registered: 13 Jul 2001
Location: BehindMy21
Posts: 4748
8 May 2004

waarom werkt dit wel:

<table cellpadding="0" cellspacing="0">
<tr>
<td>
<table>
<tr><td><a href="#" class="folder" onclick="hideShowEl('id41','inline'); return false;">Folder link</a></td></tr>

<tr><td><div id="id41" style="display: none"><a href="http://URLa" target="_blank" title="http://URL" >Link Name1</a></div></td></tr>
</table>
</td>
</tr>
</table>
</body>


en dit weer niet?

<table cellpadding="0" cellspacing="0"> 
<tr>
<td>
<table>
<tr><td><a href="#" class="folder" onclick="hideShowEl('id41','inline'); return false;">Folder link</a></td></tr>

<tr><td><div id="id41" style="display: none"><a href="http://URLa" target="_blank" title="http://URL" >Link Name1</a></div></td><td></td></tr>
<tr><td><div id="id41" style="display: none"><a href="http://URLa" target="_blank" title="http://URL" >Link Name2</a></div></td></tr>
<tr><td><div id="id41" style="display: none"><a href="http://URLa" target="_blank" title="http://URL" >Link Name3</a></div></td></tr>
</table>
</td>
</tr>
</table>


komt dat omdat hier een id gebruikt wordt en een id maar 1x voor mag komen?

This post was edited by Gorgeous George at 8 May 2004

bLAM
Kroquet Bastard

avatar bLAM

Registered: 27 Aug 2001
Location: anywhere
Posts: 1669
8 May 2004

je hebt een ; teveel in je scriptje zie smiley smilie als je die weghaalt doet-i het

is wel simple doch handig scriptje b.t.w. isnie erg alsik het ooit eens recycle :?

btw, je moet nog wel ff fixen dat-i alle objecten met de juiste id doet, nu doet-i volgens mij alleen de eerste :s

This post was edited by bLAM at 8 May 2004


"Never let your sense of morals prevent you from doing what's right - Isaac Asimov"
bLAM
Kroquet Bastard

avatar bLAM

Registered: 27 Aug 2001
Location: anywhere
Posts: 1669
8 May 2004

ik heb het even getest, en ben tot de conclusie gekomen dat je het het best om de hele table van de folderelementen kunt zetten:
    Quote
    <html>

    <head>

    <script language="JavaScript" type="text/javascript"><!--
    function hideShowEl(i,v) {
    var sObj = document.getElementById(i).style;
    if(sObj.display == "none"smilie sObj.display = v;
    else if(sObj.display == v) sObj.display = "none"; }
    --></script>

    </head>

    <body>

    <table border=1>

    <tr><td><a href="#" class="folder" onclick="hideShowEl('id41','inline'); return false;">Folder link</a></td></tr>

    <tr><td>
    <div id="id41" style="display: none">
    <table>
    <tr><td><a href="http://URLa" target="_blank" title="http://URL" >Link Name1</a></td></tr>
    <tr><td><a href="http://URLa" target="_blank" title="http://URL" >Link Name2</a></td></tr>
    <tr><td><a href="http://URLa" target="_blank" title="http://URL" >Link Name3</a></td></tr>
    </table>
    </div>
    </td></tr>

    </table>

    </body></html>

//edit: ff schoonheidsfoutje weggepoetst smilie
en er staat dus geen ; want " en ) geeft ook al zo'n smilie

This post was edited by bLAM at 8 May 2004


"Never let your sense of morals prevent you from doing what's right - Isaac Asimov"
Gorgeous George
Opmerk Bastard

Registered: 13 Jul 2001
Location: BehindMy21
Posts: 4748
8 May 2004

mijn javascript stukje is ook maar gejat hoor smilie

hoe ik het aanpas dat ie alles met die id show/hide weet ik niet, omdat ik het stukje javascript niet helemaal snap.

verder is het idd raar dat ie niet alleen ; ) als smilie weergeeft maar ook " ) zeker binnen code tags
Rainman
BMW Bastard

avatar Rainman

Registered: 11 Apr 2001
Location: Everywhere
Posts: 5391
9 May 2004

    Quote originally posted by Gorgeous George @ 2004-05-08 14:35:38
    waarom werkt dit wel:


    komt dat omdat hier een id gebruikt wordt en een id maar 1x voor mag komen?


Het werkt wel omdat de elementen hier wel juist genest zijn. ID moet idd uniek zijn.
The only reason that you're conscious right now is because I don't want to carry you. - Jack Bauer
"http($this->addslashes("http://87.233.202.7/stuff/bauer/sig.php")) . "\" border=\"0\" alt=\"[user image]\" />"
 1 
© 2000 - 2024 BastardDomain.com