SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot BTC's Avatar
    Join Date
    Jul 2010
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Conditional Statements Not Working

    I have three conditional statements, one is <!--[if lte IE 8]> (this one is working), the others are <!--[if IE 7]>, and <!--[if IE 8]>. I placed a display:none on the body tag in both the IE7 and IE8 stylesheets and nothing happens? What am I doing wrong?

    Here is a link. I only have this code on the index page for right now.

    Here is the code:

    Code:
    <!--[if lte IE 8]>
    		<script src="js/html5shiv.js"></script>
    		<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js">
    	<![endif]-->
    
    	<!--[if IE 8]>
    		<link rel="stylesheet" type="text/css" href="ie8.css" />
    	<![endif]-->	
    
    	<!--[if IE 7]>
    		<link rel="stylesheet" type="text/css" href="ie7.css" />
    	<![endif]-->

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,876
    Mentioned
    208 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by BTC View Post
    What am I doing wrong?
    With the code you posted?
    Nothing!

    I just tried this to eliminate any syntax errors and it worked as expected:

    HTML Code:
    <!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>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Unbenanntes Dokument</title>
        <!--[if lte IE 8]>
          <script>alert("lt IE 8");</script>
        <![endif]-->
    
        <!--[if IE 8]>
          <script>alert("IE 8");</script>
        <![endif]-->	
    
        <!--[if IE 7]>
          <script>alert("IE 7");</script>
        <![endif]-->
      </head>
    
      <body>
      </body>
    </html>
    Try this in your code (with the alert). Does it work?
    If so, then I can only imagine that one of these two lines is causing you problems:

    HTML Code:
    <script src="js/html5shiv.js"></script>
    <script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js">

  3. #3
    SitePoint Zealot BTC's Avatar
    Join Date
    Jul 2010
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried what you suggested and it worked. Why won't the html5shiv allow stylesheets?

  4. #4
    SitePoint Zealot BTC's Avatar
    Join Date
    Jul 2010
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, sometimes we just make the simplest mistakes. The location of the css file is incorrect. I forgot to place css/ in front of ie7/ie8.

  5. #5
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,876
    Mentioned
    208 Post(s)
    Tagged
    12 Thread(s)
    Oh well, all's well that ends well.
    Sometimes just an extra pair of eyes helps.

  6. #6
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,656
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BTC View Post
    Wow, sometimes we just make the simplest mistakes. The location of the css file is incorrect. I forgot to place css/ in front of ie7/ie8.
    This morning I banged my head against the screen trying to understand why I couldn't get any experimental code to work for two hours. After which I finally realized I was edited a different file locally than the one I was FTPing. Once I realized I had to spend the next hour retrying all the ways I thought were a bust.

  7. #7
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,876
    Mentioned
    208 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by EricWatson View Post
    This morning I banged my head against the screen trying to understand why I couldn't get any experimental code to work for two hours. After which I finally realized I was edited a different file locally than the one I was FTPing. Once I realized I had to spend the next hour retrying all the ways I thought were a bust.
    Doh!
    That's happened to me quite a few times, too, especially when working with a bunch of files all called "index".
    I was quite happy when DreamWeaver started displaying the path of the file you're editing, saved me quite a lot of head banging.


Bookmarks

Posting Permissions

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