Results 1 to 3 of 3

Thread: different servers, same code, different results

  1. #1
    Join Date
    Apr 2012

    different servers, same code, different results

    I have some client side js that works ok on one server but gives an error on another server.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Start of comments to hide JavaScript Code
    var var01 = "someText", boolThing=false

    The browser is IE 8, the webserver is IIS
    On the page where not working, I get a webpage error = expected ";" var01 is not defined.....
    so that makes sense there is no ; at the end of the var declarations but as I as said above the error does not occur on one server but does on another. on the server where I get the error, just to test I put the var declarations on separate lines each with its ; at the end, and that took care of the error
    its the same browser, and the same code rendered on the server, any ideas how one could be ok and not the other?
    and as an aside, evidently in at least this one environment js can be ok without the ; (semicolons) at the end of statements?? is that something to do with the browser being IE and really running a ms java engine and not the sun version?

  2. #2
    Join Date
    Dec 2002
    St. Louis, MO, USA
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Start of comments to hide JavaScript Code
    var var01 = "someText", boolThing=false;

    You forgot the closing semi-colon after false. You need to include one at the end of every command.
    o . Q
    ___ "You live and you learn; or you don't live long." - Lazarus Long


  3. #3
    Join Date
    Nov 2007
    @WolfShade - common misconception - you do NOT need a semi-colon at the end of the line in most circumstances. The code below works perfectly fine (in both IE8 and FF11):
    var var01 = "someText", boolThing=false
    alert('var01='+var01 +'\nboolThing='+boolThing)
    @bbxrider - there may be something else at play. Can you post more code than what you gave us?

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