; Expected error message

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 511475
    New Member
    • Nov 2006
    • 9

    #1

    ; Expected error message

    The following script will validate. It is supposed to convert from one temp scale to another. I am getting the following error " line 15 ";" expected.

    I cannot find this error. Please give me a hint
    <?xml version="1.0" encoding="utf-8" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Temperat ure Conversion</title>

    <script type="text/javascript">
    //<![CDATA[
    <!-- HIDE FROM INCOMPATIBLE BROWSERS
    var fahrenheit = new Array();
    var celcius = 0;
    for (var i = 0; i <= 100; ++i) {
    fahrenheit[i] = i;
    }
    for (var j=0, j<=100, ++j) {
    celcius = (fahrenheit[i] - 32) * .55;
    document.write( fahrenheit[i] + " degrees Fahrenheit is equal to "
    + "celcius" + Celsius.<br />");
    }
    // STOP HIDING FROM INCOMPATIBLE BROWSERS -->
    //]]>
    </script>
    </head>
    <body>
    </body>
    </html>
  • vee10
    New Member
    • Oct 2006
    • 141

    #2
    hi,

    check whether u have place ; in the
    for (var j=0, j<=100, ++j)
    otherwise
    this is urs
    document.write( fahrenheit[i] + " degrees Fahrenheit is equal to "
    + "celcius" + Celsius.<br />");
    place this
    document.write( fahrenheit[i] + " degrees Fahrenheit is equal to "
    + "celcius" + celsius.+"<br />");




    Originally posted by 511475
    The following script will validate. It is supposed to convert from one temp scale to another. I am getting the following error " line 15 ";" expected.

    I cannot find this error. Please give me a hint
    <?xml version="1.0" encoding="utf-8" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Temperat ure Conversion</title>

    <script type="text/javascript">
    //<![CDATA[
    <!-- HIDE FROM INCOMPATIBLE BROWSERS
    var fahrenheit = new Array();
    var celcius = 0;
    for (var i = 0; i <= 100; ++i) {
    fahrenheit[i] = i;
    }
    for (var j=0, j<=100, ++j) {
    celcius = (fahrenheit[i] - 32) * .55;
    document.write( fahrenheit[i] + " degrees Fahrenheit is equal to "
    + "celcius" + Celsius.<br />");
    }
    // STOP HIDING FROM INCOMPATIBLE BROWSERS -->
    //]]>
    </script>
    </head>
    <body>
    </body>
    </html>

    Comment

    • 511475
      New Member
      • Nov 2006
      • 9

      #3
      Thank you for your help. I made the following changes.<?xml version="1.0" encoding="utf-8" ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <title>Temperat ure Conversion</title>

      <script type="text/javascript">
      //<![CDATA[
      <!-- HIDE FROM INCOMPATIBLE BROWSERS
      var fahrenheit = new Array();
      var celcius = 0;
      for (var i = 0; i <= 100; ++i) {
      fahrenheit[i] = i;
      }
      for (var j=0, j<=100, ++j); {
      celcius = (fahrenheit[i] - 32) * .55;
      document.write( fahrenheit[i] + " degrees Fahrenheit is equal to "
      + "celcius" + celsius.+"<br />");
      }
      // STOP HIDING FROM INCOMPATIBLE BROWSERS -->
      //]]>
      </script>
      </head>
      <body>
      </body>
      </html>
      I still get the error "exected; at line 15.

      This is line 14 and line 15

      fahrenheit[i] = i;
      }

      puzzled

      Comment

      • buffalo
        New Member
        • Nov 2006
        • 1

        #4
        Line 15 is apparently one after what you think. On that line you had:
        for (var j=0, j<=100, ++j) {
        you changed it to:
        for (var j=0, j<=100, ++j); {
        It should be
        for (var j=0; j<=100;++j) {

        Comment

        Working...