MaG_MaN Posted June 6, 2014 Share Posted June 6, 2014 why this simple code only works on chrome?? function mostrarOcultar(obj) { document.getElementById('seguro').style.visibility = (obj.checked) ? 'hidden' : 'visible'; } this the php: <table width="100%" border="1" id="seguro" style="visibility:visible"> <tr> <td bgcolor="#B4ED89" class="Estilo3"><?php echo "Cantidad Asegurada Bs" ?></td> <td width="47%"><input name="asegu" type="text" id="asegu" size="39" onkeypress="return NumCheck(event,this)" onpaste="return false"/></td> <tr> </table> only work on chrome and perfectly Link to comment https://forums.phpfreaks.com/topic/289012-why-this-dont-work-on-firefox-or-ie/ Share on other sites More sharing options...
Ch0cu3r Posted June 6, 2014 Share Posted June 6, 2014 You have not shown how the mostrarOcultar() function called? I assume it is called with a checkbox onclick event? which you'd toogle the checkbox to show/hide the table? I testing the code like this <input type="checkbox" onclick="mostrarOcultar(this)"> <table width="100%" border="1" id="seguro" style="visibility:visible"> <tr> <td bgcolor="#B4ED89" class="Estilo3"><?php echo "Cantidad Asegurada Bs" ?></td> <td width="47%"><input name="asegu" type="text" id="asegu" size="39" onkeypress="return NumCheck(event,this)" onpaste="return false"/></td> <tr> </table> <script type="text/javascript"> function mostrarOcultar(obj) { document.getElementById('seguro').style.visibility = (obj.checked) ? 'hidden' : 'visible'; } </script> Works fine in IE11 and FF28 on Win7 Link to comment https://forums.phpfreaks.com/topic/289012-why-this-dont-work-on-firefox-or-ie/#findComment-1482065 Share on other sites More sharing options...
MaG_MaN Posted June 6, 2014 Author Share Posted June 6, 2014 Oh well sir ... the problem was because I put the javascript code before the php code. now is working!!! Link to comment https://forums.phpfreaks.com/topic/289012-why-this-dont-work-on-firefox-or-ie/#findComment-1482086 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.