Jump to content

Help With Very Basic JS and ie


Riparian

Recommended Posts

First I have little knowledge of JS.

 

The code below is a very small part of a large program and simply  displays  some options when the header is clicked and closes when double clicked.

 

Problem

On loading (including going to the next display page ) Internet explorer renders the whole page and shows ALL of the options and only once the whole page is loaded it then hides all of the options and only displays the headers... not at all desireable.

 

Is there a way to hide elements before they are displayed ?

 

Very little hair left so any help is greatly appreciated.

 

 

 

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function HideGender(){
var table = document.getElementById("GENDER");
table.style.display = 'none';
}

function DisplayGender(){
var row = document.getElementById("GENDER");
row.style.display = '';
}
</script>
</head>
<body onload="HideGender()">
<table width="180" border="0" cellspacing="0" bgcolor="#FFFFFF" >
  <form name="options" method="get" id="shapes" style="display: inline; margin: 0;" >
    <tr>
      <td><a href="#"onclick="DisplayGender()"   ondblclick="HideGender()" rel="nofollow" ><strong class="MaroonText"><em>Gender</em></strong></a></td>
    </tr>
    <tr  id="GENDER" >
      <td height="40"><fieldset class="Blu_text">
        <div align="left" >
          <!-- Male -->
          <input name="Gender_Option"  id="go1"type="radio" value="1"  onclick="form.submit()"/>
          <label for="go1">Men's </label>
          <br />
          <!-- Female -->
          <input name="Gender_Option"  id="go2" type="radio" value="2" onclick="form.submit()"/>
          <label for="go2">Women's </label>
          <br />
          <!-- Kids -->
          <input name="Gender_Option"  id="go3"type="radio" value="3"  onclick="form.submit()"/>
          <label for="go3">Kids </label>
          <br />
          <!-- All genders-->
          <input name="Gender_Option" id="go4" type="radio" value="4" <?php if($_SESSION[Gender_Option] == "4" ){echo 'checked';}else{echo '';}?> onclick="form.submit()"/>
          <label for="go4">Show All </label>
        </div>
      </fieldset></td>
    </tr>
  </form>
</table>
</body>

Link to comment
https://forums.phpfreaks.com/topic/241374-help-with-very-basic-js-and-ie/
Share on other sites

oops sorry..I was mixing visibility and display.

 

<head>
<style type='text/css'>
#GENDER {
  display : none;
}
</style>
<script type="text/javascript">
function HideGender(){
var table = document.getElementById("GENDER");
table.style.display = 'none';
}

function DisplayGender(){
var row = document.getElementById("GENDER");
row.style.display = 'inline'; // or 'block' depending on the rest of your layout/preference
}
</script>
</head>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.