Jump to content

Recommended Posts

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.