Here is their script:
Code:
<script type="text/javascript">
function OpenLayer(id){
if(document.getElementById(id).style.display == "block") {
document.getElementById(id).style.display = "none" ;
} else {
document.getElementById(id).style.display = "block" ;
}
window.status = document.getElementById(id).style.display;
}
</script>
and here is an example of their markup that uses it:
Code:
<table border="0" width="100%" cellspacing="1" cellpadding="1">
<tr bgcolor="#FFFFFF">
<td><a href="javascript:OpenLayer('commentaire1');"
onmouseout="window.status='';return true;" onmouseover="window.status='Les Commentaires';return true;">
<b>Bon de commande en PDF ?</b></a></td>
<td align="left">
par <a href="/scripts/?auteur=9275">Fred VICTOR</a>
</td>
<td nowrap="nowrap" align="center">
<img src="/images/star/star_9.gif" width="55" height="12" alt="9/10" /></td>
</tr>
<tr>
<td colspan="3" bgcolor="#F2F5F7">
<div id="commentaire1" style="display:none">
Le : <u>20-04-2005</u>
<blockquote>
bonjour à tous <br />
pour ma part trés satisfait de ce script, je me demandais si grâce à FPDF il y aurait possibilité de générer le bon de commande en PDF. Ceci permettrait trés simplement de l'imprimer OU de l'adresser par mail pour compléter un paiement en ligne (Paypal par exemple). Je pense que c'est possible mais je ne suis pas personnellement assez baléze pour l'aboutir. Si d'aucuns veulent si intéresser ... </blockquote>
</div>
</td>
</tr>
I'm not wild about the some of the methods used but, it is simple and shows one important feature of any set-up of this kind. The content to be expanded is in a division (<div>) inside a table cell (<td>) not a table element (<table>, <tbody>, <tr> or <td>) itself.
Colors:
Blue: essential script calls & style
Red: id used for this particular case, each case needs a unique id
Green: added features, that either enhance (mouse events) or allow for proper display/format (colspan=3 - spans the width of this three column table).
You normally should ask permission to use this but, if I could read French, I think I might see that the page is a demo or leads to a demo. I take it that you read the language so, you decide.
Bookmarks