Link to home
Start Free TrialLog in
Avatar of mtb007
mtb007

asked on

** URGENT DHTML DIV in net 4.7 **

I have a dropdown menu that uses a DIV tag in DHTML.  I need it to work in both netscape 4.7 and IE 5.0.  It works in IE, but not in Newtscape.  Here is the code, can somebody please tell me whay this dosent work in netscape?

If there is another way to get this to work, i dont care, as long as it works... maybe Show/Hide?

Thanks

Mtb007


<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- this is the code sorce that tells the rollovers to work-->
<script src="changeimage.js"></script>
<!-- this is where you name you different rollover files-->
<script src="nav.js"></script>
<!-- this is the code sorce that tells the rollovers to work-->
<script type="text/javascript">


<!-- All of this code below is so that Netscape can view the DIV tag-->
<!--
function toggle(theDiv){
      var elem = document.getElementById(theDiv);
      elem.style.display = (elem.style.display == "none")? "" : "none";
}
// -->
</script>
<style type="text/css">
<!--
img{
      border: 0px;
}
-->
</style>
<script language="JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>


</head>
<body>
<!-- This code below HERE is what controls to position of the dropdown.

The position should be fairly close to where you need to place it.
You will probably nee to adjust it, and play with the numbers to get it exactaly where you need it.
To do that adjust the "left:____" & "top:____" numbers.  the numbers are setting the top left corner of the dropdown menu.  -->

<div id="Layer1" style="position:absolute; left:504px; top:173px; width:265px; height:277px; z-index:1"><span id="menuItems" style="width: 265px; display: none;">
<!-- This code HERE is that drop down menu with the rollovers -->
<a href="http://yoursite.com" onMouseOver="changeImages('sales', 'sales_on')" onMouseOut="changeImages('sales', 'sales_off')"onClick="toggle('menuItems');"><img name="sales" src="sales_off.gif" width="265" height="37" border="0"></a><br/>
      <a href="http://yoursite.com" onMouseOver="changeImages('borrower', 'borrower_on')" onMouseOut="changeImages('borrower', 'borrower_off')"onClick="toggle('menuItems');"><img name="borrower" src="borrower_off.gif" width="265" height="22" border="0"></a><br/>
      <a href="http://yoursite.com" onMouseOver="changeImages('agency', 'agency_on')" onMouseOut="changeImages('agency', 'agency_off')"onClick="toggle('menuItems');"><img name="agency" src="agency_off.gif" width="265" height="22" border="0"></a><br/>
      <a href="http://yoursite.com" onMouseOver="changeImages('agencyinfo', 'agencyinfo_on')" onMouseOut="changeImages('agencyinfo', 'agencyinfo_off')"onClick="toggle('menuItems');"><img name="agencyinfo" src="agencyinfo_off.gif" width="265" height="22" border="0"></a><br/>
      <a href="http://yoursite.com" onMouseOver="changeImages('billinginfo', 'billinginfo_on')" onMouseOut="changeImages('billinginfo', 'billinginfo_off')"onClick="toggle('menuItems');"><img name="billinginfo" src="billinginfo_off.gif" width="265" height="22" border="0"></a><br/>
      <a href="http://yoursite.com" onMouseOver="changeImages('entity', 'entity_on')" onMouseOut="changeImages('entity', 'entity_off')"onClick="toggle('menuItems');"><img name="entity" src="entity_off.gif" width="265" height="22" border="0"></a><br/>
      <a href="http://yoursite.com" onMouseOver="changeImages('pf', 'pf_on')" onMouseOut="changeImages('pf', 'pf_off')"onClick="toggle('menuItems');"><img name="pf" src="pf_off.gif" width="265" height="22" border="0"></a><br/>
      <a href="http://yoursite.com" onMouseOver="changeImages('salesreference', 'salesreference_on')" onMouseOut="changeImages('salesreference', 'salesreference_off')"onClick="toggle('menuItems');"><img name="salesreference" src="salesreference_off.gif" width="265" height="22" border="0"></a><br/>
      <a href="http://yoursite.com" onMouseOver="changeImages('spc', 'spc_on')" onMouseOut="changeImages('spc', 'spc_off')"onClick="toggle('menuItems');"><img name="spc" src="spc_off.gif" width="265" height="22" border="0"></a><br/>
      <a href="http://yoursite.com" onMouseOver="changeImages('salesterritory', 'salesterritory_on')" onMouseOut="changeImages('salesterritory', 'salesterritory_off')"onClick="toggle('menuItems');"><img name="salesterritory" src="salesterritory_off.gif" width="265" height="22" border="0"></a><br/>
<a href="http://yoursite.com" onMouseOver="changeImages('underwriting', 'underwriting_on')" onMouseOut="changeImages('underwriting', 'underwriting_off')"onClick="toggle('menuItems');"><img name="underwriting" src="underwriting_off.gif" width="265" height="37" border="0"></a><br/>
<a href="http://yoursite.com" onMouseOver="changeImages('parameter', 'parameter_on')" onMouseOut="changeImages('parameter', 'parameter_off')"onClick="toggle('menuItems');"><img name="parameter" src="parameter_off.gif" width="265" height="37" border="0"></a><br/>
</span>
<div style="width: 265px; height: 28px;" ><a href="#" onClick="toggle('menuItems');return false;"><img src="admin_nav.gif" width="265" height="28" border="0"></a></div>
</div>
This is where you start building the rest of the site.


</body>
</html>
Avatar of tatlady
tatlady

i believe netscape didn't support dhtml until version 6.0.
Avatar of mtb007

ASKER

is there any way to do it in 4.7?
not that I'm aware of. if you're writing asp or coldfusion or something like that, you could test for browser and use different verisons of the html depending on the browser accessing the file.
i do not know what the 2 *.js files do so i cannot help with them, but you can show hide div in 4.7

its a matter of testing for document.all,document.layers,document.getElementById

and also in NS4 you will have to ABSOLUTE position the div's
ASKER CERTIFIED SOLUTION
Avatar of jaysolomon
jaysolomon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This

>>>function toggle(theDiv){
    var elem = document.getElementById(theDiv);
    elem.style.display = (elem.style.display == "none")? "" : "none";
}
<<<

Which looks like what i wrote, will work in NS6+ and IE5+
Avatar of mtb007

ASKER

The 2 *.js files are for the rollovers.  I have the DIV position set to ABSOLUTE.  Can you explain further about the document.all ... etc..? i dont understand..
document.all = IE4

document.layers = NS4
 
document.getElementById = NS6+/IE5+/D O M

If you want this to work in NS4(which not alot of people use) then it can be done, you need to post your full source so we can then fix it the first time(hopefully).

In the upper code i do not see any div/layer name menuItems
Avatar of mtb007

ASKER

What i pasted above was everything,  except the js files. the only thing that they do is give the *.gif ID names to reference for the rollover.  
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial