Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 09-07-2006, 02:02 PM   #1 (permalink)
toe_cutter
Code Monkey
 
Join Date: Aug 2002
Location: Boston, MA
Posts: 79
toe_cutter is on a distinguished road
Send a message via ICQ to toe_cutter Send a message via AIM to toe_cutter Send a message via Yahoo to toe_cutter
iframes/css and IE?

I have no idea if I made this more difficult then it needs to be? I cannot for the life of me get this working in IE. Firefox work flawlessly.

What I did was use tables to make a page that looks something like this

------HEADER--------

LEFT--MIDDLE--RIGHT

------FOOTER--------


I used javascript to make neat looking mouse over effect for the navigation bar, and then used php to load the content for the middle page. Basically is this even possible to do it this way with IE?

I think I included the relivent code, so if there is something you need to see let me know.

Toe

index.php
PHP Code:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
<?php
include("start_page.php");
?>

<table border="0" width="100%" cellspacing="5" cellpadding="5" align="center">
<tr align="center" valign="top">
        <td colspan="2">
                <!-- Header -->
                <?php include("header.php"); ?>
        </td>
</tr>
<tr align="center" valign="top">
        <td width="10%" align="left" valign="top">
                <!-- menu -->
                <?php include("left.php"); ?>
        </td>

        <td width="60%" align="left" valign="top">
                <!-- Main Conent -->
                <?php include("middle.php"); ?>
        </td>
</tr>
<tr align="center" valign="top">
        <td colspan="2" width="100%" align="center" valign="top">
                <!-- Footer goes here. -->
                <?php include("footer.php"); ?>
        </td>
</tr>
</table>

<?php
include("end_page.php");
?>
left.php
PHP Code:
<table class="content" border="0" width="100%" align="center" valign="top">
  <tr>
    <td class="title">Main Menu</td>
  </tr>
  <tr>
    <td>
      <!-- HOME -->
      <a class="menu" href="content.php?page=News" target="iframe"><strong><big>&ndash;</big></strong>&nbsp;Home</a><br />


<div>
      <!-- DOCUMENTS -->
      <a class="menu" href="#" onMouseOver="hideAll(); showLayer('documentMenu'); stopTime()" onMouseOut="startTime();">
      &not;&nbsp;Documents<br /></a>
      <div class="subMenu" id="documentMenu">
<?php
  $results 
DBSearchOrder"documents""name" );
  while(
$row = @mysql_fetch_array($results)) {
?>

      <a class="menu" href="content.php?page=document&fileName=<?php echo "$row[fileName]" ?>" target="iframe" onMouseOver="stopTime();" onMouseOut="startTime();"><?php echo "$row[name]" ?></a><br />

<?php
  
}
?>
  </div>
</div>


      <!-- LINKS -->
      <a class="menu" href="content.php?page=Links" target="iframe"><strong><big>&ndash;</big></strong>&nbsp;Links</a><br />


<div>
      <!-- About Us -->
      <a class="menu" href="#" onMouseOver="hideAll(); showLayer('aboutUsMenu'); stopTime()" onMouseOut="startTime();">
        &not;&nbsp;About Us
      </a>
      <div class="subMenu" id="aboutUsMenu">
        <a class="menu" href="content.php?page=mission" target="iframe" onMouseOver="stopTime();" onMouseOut="startTime();">Mission Statement</a><br />
        <a class="menu" href="content.php?page=Members" target="iframe" onMouseOver="stopTime();" onMouseOut="startTime();">Members</a><br />
      </div>
</div>

    </td>
  </tr>
  <tr>
    <td class="title">Clear Trust</td>
  </tr>
  <tr>
    <td>
<div>
      <a class="menu" href="#" onMouseOver="hideAll(); showLayer('ctTestReportMenu'); stopTime()" onMouseOut="startTime();">&not;&nbsp;API Test Report Archive<br /></a>
      <div class="subMenu" id="ctTestReportMenu">
        <a class="menu" href="content.php?page=ctDevelopment" target="iframe" onMouseOver="stopTime();" onMouseOut="startTime();">Development</a><br />
        <a class="menu" href="content.php?page=ctRelease" target="iframe" onMouseOver="stopTime();" onMouseOut="startTime();">Release</a><br />
      </div>
</div>
      <a class="menu" href="content.php?page=ctLinks" target="iframe"><strong><big>&ndash;</big></strong>&nbsp;Links</a><br />
      <a class="menu" href="content.php?page=ctMachines" target="iframe"><strong><big>&ndash;</big></strong>&nbsp;Machines</a><br />
      <a class="menu" href="content.php?page=ctRequest" target="iframe"><strong><big>&ndash;</big></strong>&nbsp;Request Build</a><br />
      <a class="menu" href="content.php?page=ctSchedule" target="iframe"><strong><big>&ndash;</big></strong>&nbsp;Test Schedules</a><br />
      <a class="menu" href="content.php?page=ctTinderbox" target="iframe"><strong><big>&ndash;</big></strong>&nbsp;Tinderbox</a><br />
    </td>
  </tr>

</table>
middle.php
PHP Code:
<table border="0" width="100%" align="center" valign="top">
<
tr>
  <
td>
    <
iframe id="iframe" name="iframe" src="content.php" align=left frameborder=0 onload="resize_iframe('iframe')"></iframe>
  </
td>
</
tr>
</
table
content.php
PHP Code:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
<?php
include("start_page.php");

$page $_GET['page'];
$fileName "content/documents/" $_GET['fileName'] . ".php";

switch(
$page) {
case 
"Links":
        include(
"content/links.php");
        break;
case 
"Members":
        include(
"content/members.php");
        break;
case 
"mission":
        include(
"content/mission.php");
        break;
case 
"document":
        include(
$fileName);
        break;
case 
"News":
default:
        include(
"content/news.php");
        break;
}
include(
"end_page.php");
?>
CSS
Code:
iframe {
  z-index : 100;
  width: 100%;
  scrolling: no;
}

div { position: relative; }
div.subMenu {
  background-color: #cccccc;
  layer-background-color: #cccccc;
  font-size: small;
  border: 1px inset #000000;
  width: 140px;
  top: 0px; /* Need to include this inline example: style="top:140px" I need to figure out a better way.*/
  left: 110px;
  position: absolute;
  z-index: 90;
  visibility: hidden;
}

JavaScript
Code:
var activeSub=0;
var SubNum=0;

function reDo(){ window.location.reload() }
window.onresize = reDo;


//Define global variables

var timerID = null;
var timerOn = false;
var timecount = 500;
var what = null;
var newbrowser = true;
var check = false;

function init(){
  //  alert ("Running Init");
  if (document.layers) {
    //  alert ("Running Netscape 4");
    layerRef="document.layers";
    styleSwitch="";
    visibleVar="show";
    screenSize = window.innerWidth;
    what ="ns4";

  } else if(document.all){
    //  alert ("Running IE");
    layerRef="document.all";
    styleSwitch=".style";
    visibleVar="visible";
    screenSize = document.body.clientWidth + 18;
    what ="ie";

  } else if(document.getElementById){
    //  alert ("Running Netscape 6");
    layerRef="document.getElementByID";
    styleSwitch=".style";
    visibleVar="visible";
    what="moz";

  } else{
    //alert("Older than 4.0 browser.");
    what="none";
    newbrowser = false;
  }

  window.status='status bar text to go here';
  check = true;
}

// Turns the layers on and off
function showLayer(layerName){
  if(check){
    if (what =="none"){
      return;
    } else if (what == "moz"){
      document.getElementById(layerName).style.visibility="visible";
    } else{
      eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
    }
  } else {
    // alert ("Please wait for the page to finish loading.");
    return;
  }
}

function hideLayer(layerName){
  if(check){
    if (what =="none"){
      return;
    } else if (what == "moz"){
      document.getElementById(layerName).style.visibility="hidden";
    } else{
      eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
    }
  } else {
    // alert ("Please wait for the page to finish loading.");
    return;
  }
}

function hideAll(){
  hideLayer('documentMenu');
  hideLayer('aboutUsMenu');
  hideLayer('ctTestReportMenu');
}

function startTime() {
  if (timerOn == false) {
    timerID=setTimeout( "hideAll()" , timecount);
    timerOn = true;
  }
}

function stopTime() {
  if (timerOn) {
    clearTimeout(timerID);
    timerID = null;
    timerOn = false;
  }
}

function onLoad(){
  init();
}
__________________
toe_cutter is offline   Reply With Quote
Old 09-08-2006, 07:02 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
i think IE chokes on colspan when you are trying to align things nicely. try just putting your middle content that contains colums in its own table.

notice i set your first table to a heighth of 100%. this is optional, but necessary if you want the footer to align with the bottom of the screen.

next, i set your height of the footer and header to "XX" .. replace that with the height you want for those. by specifying the height of those 2 cells, it will allow the center to be scalable.

for your column content on the inner table, i notice you use percents. i'd recommend a fixed width for the left and right and allow the middle to be scalable for this type of layout.. but that is a personal preference.

here's an example of what i just described:
HTML Code:
<table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0" align="center"> <tr align="center" valign="top"> <td height="XX"> <!-- Header --> <?php include("header.php"); ?> </td> </tr> <tr> <td valign="top"> <table border="0" cellspacing="5" cellpadding="5" width="100%"> <tr align="center" valign="top"> <td width="150" align="left" valign="top"> <!-- menu --> <?php include("left.php"); ?> </td> <td align="left" valign="top"> <!-- Main Conent --> <?php include("middle.php"); ?> </td> </tr> </table> </td> </tr> <tr> <td height="XX" width="100%" align="center" valign="top"> <!-- Footer goes here. --> <?php include("footer.php"); ?> </td> </tr> </table>
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 02:56 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting