You are not logged in.
Hello
I have a problem
I want to use two buttons to show / hide two areas
Initially, the areas should be hidden.
problem :
When I click on a button, xinha not displayed correctly (height width = 0)
http://www.etab.ac-caen.fr/bsauveur/x.png
If I use hidden visibility it is OK (http://www.etab.ac-caen.fr/bsauveur/cah … /essai.php
But I must use display none
You can test the problem here :
http://www.etab.ac-caen.fr/bsauveur/cah … essai2.php
Code with problem :
<?php include('area_test.php'); // load xinha ?>
<script type="text/javascript">
function show_hide(id)
{
if(document.getElementById(id).style.display=="none")
{
document.getElementById(id).style.display="block";
document.getElementById('button_'+id).innerHTML='SHOW ';
}
else
{
document.getElementById(id).style.display="none";
document.getElementById('button_'+id).innerHTML='HIDE ';
}
return true;
}</script>
<span id="button_text1" onclick="javascript:show_hide('text1');">SHOW</span>
<span id="button_text2" onclick="javascript:show_hide('text2');">SHOW</span>
<div id="text1">
zone1
<textarea cols="40" rows="20" id="zone1" ></textarea>
</div>
<div id="text2">
zone2
<textarea cols="40" rows="20" id="zone2" ></textarea>
</div>
<script>
show_hide('text1');
show_hide('text2');
</script>
Sorry for my language;))
Thanks
Last edited by frenchie50 (2011-11-22 15:17:56)
Offline
Unfortunately it is not possible, you must have the Xinha displayed (visibility:hidden is OK) in order for it to work correctly when it is generated.
Once it is displayed, you can set display:none then, but initially, it mus be displayed.
You can of course delay generating the Xinha area until you display the textarea, you will have to write Javascript to do so.
James Sleeman
Offline