Advertisement

03.10.2006 at 04:13PM PST, ID: 21769391
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.4

Javascript rolldown and Browser issue

Asked by mshirazi1 in JavaScript

Tags: , ,

Hi
I have the following javascript rolldown. When I leave Doctyoe in the code, it works fine with Internet Explorer but it doesn't work with Firefox. When I erase the Doctype, it works smoothly in firefox but not in IE. Can somebody tell me how can I make my rolldown compatible with both browsers.  Is it a Doctype issue or I can fix it by changing my Divs syntax.
Thanks
Faraz



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<script language="javascript">
slideSpeed = 20;
function toggle(elementId)
{
  obj = document.getElementById(elementId);
     while(obj.nextSibling && (obj.className != 'menu')) obj =
obj.nextSibling;

     obj.speed = -1 * obj.speed;
     if(obj.slideTimer) return;     //Already moving

     var x = slider.length;
     slider[x] = obj;
     slide(x);
}

function initMenus()
{
     if(!document.getElementsByTagName) return;

     slider = new Array();
     var divs = document.getElementsByTagName('div');

     for(var x=0; x<divs.length; x++) {
          divs[x].originalHeight = parseInt(divs[x].style.height);
          if(divs[x].className == 'menu') divs[x].speed = -1;
     }


     for(var x=0; x<divs.length; x++) {

    // Hide the Menu DIV's
          if(divs[x].className == 'menu'){
      divs[x].style.height = '1px';
      divs[x].style.display = 'none';
    }

    // Also, Hide buttons associated with the DIV's
          if(divs[x].className == 'hiddenButton'){
      divs[x].style.display = 'none';
    }
     }
}

function slide(x)
{
     var obj = slider[x];
     if(obj.style.display != 'block') obj.style.display = 'block';
     var height = obj.offsetHeight + obj.speed * slideSpeed;
     var targetHeight = obj.originalHeight;

     if(height > targetHeight)
     {
          obj.style.height = targetHeight + 'px';
          obj.slideTimer = false;
    // Show the Button Too
    document.getElementById(obj.id+'Button').style.display = 'block';
          return;
     }

     if(height <= 1)
     {
          obj.style.height = '1px';
          obj.style.display = 'none';
    // Hide the Button Too
    document.getElementById(obj.id+'Button').style.display = 'none';
          obj.slideTimer = false;
          return;
     }

     obj.style.height = height + 'px';
     obj.slideTimer = setTimeout('slide(' + x + ');', 40);
}
</script>

</head>
<body onload="initMenus();">
                  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="5px"><img src="image/spacer.gif" alt="" width="5" height="10"></td>

                    <td><div style="float: left; height: 17px;"><a href="javascript:toggle('physicianLogin');" class="leftmenu">Physician Login</a></div><div align="right" id="physicianLoginButton" class="hiddenButton"><input type="image" src="image/go.gif"/></div>
                        <div id="physicianLogin" class="menu" style="height: 85px">
                        <br>
                                username: <br><input type="text" name="username" class="menuInput"/>
                          password: <br><input type="password" name="password" class="menuInput"/>
                        </div>
                    </td>
                  </tr>

                </table>
             
</body>
</html>


Start Free Trial
[+][-]03.11.2006 at 08:13AM PST, ID: 16163332

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: JavaScript
Tags: javascript, rolldown, div
Sign Up Now!
Solution Provided By: bubbledragon
Participating Experts: 1
Solution Grade: C
 
 
[+][-]03.13.2006 at 12:22PM PST, ID: 16177489

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32