Javascript Tutorial Error(Please close figured it out)

Discussion in 'Web Design and Development' started by kitki83, Mar 22, 2008.

  1. macrumors 6502a

    Joined:
    Mar 31, 2004
    Location:
    Los Angeles
    #1
    Hello, I doing this tutorial on JS book. I cannot figure out where in the beginning I am having errors. W3C does not validate JS and I am copying straight from the book and not getting it correct if someone can point out my errors, I will appreciate it. Trying to figure this out so I will know how to do the HW problem.


    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Comparison Examples</title>
    </head>
    
    <body>
    
    
    <script type="text/javascript">
    <!-- HIDE FROM INCOMPATIBLE BROWSERS
    var returnValue;
    var value1 = "First text string";
    var value2 = "Second text string";
    
    value1 == value2 ? 
    document.write("<p> value1 equal to value2: true <br />") : 
    document.write("<p> value1 equal to value2: false <br />");
    
    value1 = 50;
    value2 = 75;
    
    returnValue = value1 == value2;
    document.write("value1 equal to value2: " + returnValue + "<br />");
    
    returnValue = value1 != value2;
    document.write("value1 not equal to value2: " + retunValue + "<br />");
    
    returnValue = value1 > value2;
    document.write("value1 greater than value2: " + retunValue + "<br />");
    
    
    returnValue = value1 < value2;
    document.write("value1 less than value2: " + retunValue + "<br />");
    
    returnValue = value1 >= value2;
    document.write("value1 greater than or equal to value2: " + retunValue + "<br />");
    
    returnValue = value1 <= value2;
    document.write("value1  less than or equal to value2: " + retunValue + "<br />");
    
    
    value1 = 25;
    value2 = 25;
    
    returnValue = value1 == value2;
    document.write("value1 equal to value2 AND the same data type: " + returnValue + "<br />");
    
    returnValue = value1 !== value2;
    document.write("value1 not equal to value2 AND not the same data type: " + returnValue + "</p>");
    
    
    // STOP HIDING FROM INCOMPATIBLE BROWSERS -->
    </script>
    
    </body>
    </html>
    
    I found it, I just copy and pasted it on Word and saw the problem, sorry for the post. But still are there JS validators(similar to W3C) and whats a good program for JS, kinda not liking Dreamweaver for this material.
     

Share This Page