www.webdeveloper.com
Results 1 to 13 of 13

Thread: HTML in internet explorer

  1. #1
    Join Date
    Mar 2010
    Posts
    60

    HTML in internet explorer

    Hi all,
    Ive built a site using a mixture of HTML, CSS, PHP and some javascript. The problem is that it displays fine in Firefox and chrome but in IE 8 its all over the place. Generally the side menus display ok but the content in the main divs is moved all over the place.

    Ive validated it and cant seem to find the problem.
    Heres the code
    Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <?php
    include'';
    ?>
    
      <?php 
    			 $sql="SELECT b.message, r.rightphoto, i.indexphoto FROM blog b, rightphoto r, indextop i";
    			$result=mysql_query($sql) or die (mysql_error());
    
    			while($r=mysql_fetch_array($result)){
    				$num=mysql_numrows($result);
    			
    			$message=$r["message"];
    			$rightphoto=$r["rightphoto"];
    			$indexphoto=$r["indexphoto"];
    }
    			?>
                
              <?php
    function rteSafe($strText) {
    	//returns safe code for preloading in the RTE
    	$tmpString = $strText;
    	
    	//convert all types of single quotes
    	$tmpString = str_replace(chr(145), chr(39), $tmpString);
    	$tmpString = str_replace(chr(146), chr(39), $tmpString);
    	$tmpString = str_replace("'", "'", $tmpString);
    	
    	//convert all types of double quotes
    	$tmpString = str_replace(chr(147), chr(34), $tmpString);
    	$tmpString = str_replace(chr(148), chr(34), $tmpString);
    //	$tmpString = str_replace("\"", "\"", $tmpString);
    	
    	//replace carriage returns & line feeds
    	$tmpString = str_replace(chr(10), " ", $tmpString);
    	$tmpString = str_replace(chr(13), " ", $tmpString);
    	
    	return $tmpString;
    }
    ?>
    
    
    <title>Home</title>
    <link href="layout.css" rel="stylesheet" type="text/css" />
    
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
    <script language="JavaScript" type="text/javascript" src="rte/cbrte/html2xhtml.min.js"></script>
    <script language="JavaScript" type="text/javascript" src="rte/cbrte/richtext_compressed.js"></script>
    
    <script type="text/javascript">
    function ShowHide(){
    $("#slidingDiv").animate({"height": "toggle"}, { duration: 1000 });
    }
    </script>
    
    <script type="text/javascript">
    <!--
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    //-->
    </script>
    </head>
    
    <body onload="MM_preloadImages('images/serviceson.png','images/catalogueon.png','images/donegalrallygearon.png','images/contactuson.png','images/aboutuson.png')">
    <div id="wrapper">
      <div id="header">
        <div id="headerright">
          <div id="insideheaderright">
             <?php 
    			 $sql="SELECT * FROM indextop ";
    			$result=mysql_query($sql) or die (mysql_error());
    
    			while($r=mysql_fetch_array($result)){
    			$num=mysql_numrows($result);
    			
    			$indexphoto=$r["indexphoto"];
    			}
    			
         
         
                			 printf("<center><img src='indextop/$indexphoto' width='430' height='162' alt='$indexphoto (83 bytes)'>");
    ?>
          
          <?php
             if (isset($_COOKIE["user"])){
    					?>   
                
                <form enctype="multipart/form-data" action="addindextop.php" method="post">
    			<input type="file" name="photo" />
            	<input type="submit" value="Upload" />
                   
                </form> 
                <?php
    		 			}
        		?>
          </div>
        </div>
        <div id="headerleft"><img src="images/logo.png" width="585" height="167" alt="candmlogo" /></div>
      </div>
      <div id="navigation">
        menu bar is here
      </div>
      <div id="main">
        <div id="mainleft">
         
        
    <div id="slidingDiv">
    <p style="display: none">
    
    <table width="230" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#EDEDED">
    <form name="form1" method="post" action="checklogin.php">
    <tr>
    <td>
    <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#EDEDED">
    <tr>
    <td width="78">Username</td>
    <td width="6">:</td>
    <td width="294"><input name="myusername" type="text" id="myusername" /></td>
    </tr>
    <tr>
    <td>Password</td>
    <td>:</td>
    <td><input name="mypassword" type="password" id="mypassword" /></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input type="submit" name="Submit" value="Login" /></td>
    </tr>
    </table>
    </td>
    </tr>
    </form>
    </table> </p><a onclick="ShowHide(); return false;" href="#"></a></div>
          <div id="insidemainleft">
            <table width="230" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <th width="220" scope="col"><img src="images/previouswork.png" width="208" height="58" /></th>
              </tr>
              <tr>
                <td bgcolor="#FFFFFF"><div align="center"><?php include'test1.php' ?></div></td>
              </tr>
            </table>
          </div>
           <div id="lowerleft">
                <?php
             if (isset($_COOKIE["user"])){
    					?>   
                <a href="admin.php"> Admin </a>
                <form enctype="multipart/form-data" action="addleftphoto.php" method="post">
    			<input type="file" name="photo" />
            	<input type="submit" value="Upload" />
                   
                </form> 
                <?php
    		 			}
        		?>
                </div>
        </div>
        <div id="mainright">
          <div id="insidemainright">
            <table width="230" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <th bgcolor="#000000" scope="col"><img src="images/offers.png" width="208" height="58" /></th>
              </tr>
              <tr>
                <td bgcolor="#FFFFFF"><div align="center"><?php include'rightphoto.php'; ?></div></td>
              </tr>
            </table>
          </div>
            <div id="lowerright">  <?php
             if (isset($_COOKIE["user"])){
    					?>   
                
                <form enctype="multipart/form-data" action="addrightphoto.php" method="post">
    			<input type="file" name="photo" />
            	<input type="submit" value="Upload" />
                   
                </form> 
                <?php
    		 			}
        		?>
                </div>
        </div>
        <div id="maincentre">
          <p><a onclick="ShowHide(); return false;" href="#"><img src="images/login.png" /></a></p>
    <div id="insidemaincentre">
          
         
                <?php //echo $message; ?>
      </div>
          
           <?php
             if (isset($_COOKIE["user"])){
    					?>  
          
    <center>
    <form name="RTEDemo" action="addblog.php" method="post" onsubmit="return submitForm();">
    <script language="JavaScript" type="text/javascript">
    
    function submitForm() {
    	
    	updateRTEs();
    	
    	return true;
    }
    
    
    initRTE("rte/cbrte/images/", "rte/cbrte/", "", true);
    
    </script>
    
    <script language="JavaScript" type="text/javascript">
    
    var rte1 = new richTextEditor('rte1');
    <?php
    //format content for preloading
    if (!(isset($_POST["rte1"]))) {
    	$content = "here's the " . chr(13) . "\"preloaded <b>content</b>\"";
    	$content = rteSafe($content);
    } else {
    	//retrieve posted value
    	$content = rteSafe($_POST["rte1"]);
    }
    ?>
    rte1.html = '<?=$content;?>';
    //rte1.toggleSrc = false;
    rte1.build();
    
    </script>
    <p><input type="submit" name="submit" value="Submit" /></p>
    </form>
    <a href="logout.php">logout</a>
    <?php
    }
    ?>  
    </center> 
    </div>
        <div id="footer"><img src="images/ourfooter.png" width="1014" height="28" /></div>
      </div>
    </div>
    </body>
    </html>
    1 error I have occurs when I try to use an echo statement in one of the divs here.
    Code:
    <div id="insidemaincentre">
          
         
                <?php //echo $message; ?>
      </div>
    When this code is active it really screws up the page.

    Can anyone help or at least point me in the right direction? I'll post any code requested.
    Thanks in advance

  2. #2
    Join Date
    Aug 2006
    Posts
    1,897
    IE has a lot of trouble if your page doesn't have a doctype. Does yours, or doesn't it? You don't show one here, but you say the page validates?

    Dave

  3. #3
    Join Date
    Mar 2010
    Posts
    60
    I do, I just removed it because there was too much text in the post.

    Edit: heres the doctype
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    Last edited by jimmyg; 03-26-2011 at 01:33 PM.

  4. #4
    Join Date
    Aug 2006
    Posts
    1,897
    Can you give us a link to the live site? It's a lot easier to check that way.

    Dave

  5. #5
    Join Date
    Mar 2010
    Posts
    60
    Quote Originally Posted by tracknut View Post
    Can you give us a link to the live site? It's a lot easier to check that way.

    Dave
    Sorry I havent actually put it online yet, Im running it on a wamp server installed on my laptop. The client its for hasnt arranged hosting yet either. Would screenshots be helpful?

  6. #6
    Join Date
    Aug 2006
    Posts
    1,897
    Not really... I use Firebug to walk through such problems, and without recreating your entire site myself, it's a matter of just staring at the code to see if I can spot an error, which only works on rare occasion. Sorry about that!

    Dave

  7. #7
    Join Date
    Mar 2010
    Posts
    60
    Quote Originally Posted by tracknut View Post
    Not really... I use Firebug to walk through such problems, and without recreating your entire site myself, it's a matter of just staring at the code to see if I can spot an error, which only works on rare occasion. Sorry about that!

    Dave
    Dont worry the fact that youre even trying to help is greatly appreciated!
    Can I ask what firebug is?

  8. #8
    Join Date
    Aug 2006
    Posts
    1,897
    Firebug is an add-on to Firefox, that helps you analyze a web site, its html & css, its performance, etc. Once you have it, you'll wonder what you did before you had it.

    http://getfirebug.com/

    Dave

  9. #9
    Join Date
    Mar 2010
    Posts
    60
    Cool thanks! Ill try that and see if it picks anything up. If I need to can I post the results here?

  10. #10
    Join Date
    Aug 2006
    Posts
    1,897
    Take a look at it and see what you think. It's more of a tool to let you debug your code with, rather than something like the validator which spits out errors. So there aren't really "results" to post...

    Dave

  11. #11
    Join Date
    Mar 2010
    Posts
    60
    After working with firebug for a while, Im at a loss. Its not showing any errors or warnings.

  12. #12
    Join Date
    Mar 2010
    Posts
    60
    Finally figured it out. IE for some reason didnt like the div set up in the main area.

    Thanks Tracknut for your help and time!

  13. #13
    Join Date
    Aug 2006
    Posts
    1,897
    No problem, glad you got it figured out!
    Dave

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles