Results 1 to 7 of 7

Thread: whats this

  1. #1

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727

    whats this

    why do some lines of javascript code have ";" at the end.

  2. #2
    Lively Member
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    96
    else you get an error

    it's to close the 'function'
    http://www.raketje.com coming..............soon................

  3. #3

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727
    I wrote the following and removed all the ";" and it didnt error at all

    VB Code:
    1. <script language="JavaScript">
    2.     function checker(){
    3.         var complete  = "F" ;
    4.         var message   = ""  ;
    5.         var error     = ""  ;
    6.         var acc_count = 0   ;
    7.         var text      = ""  ;
    8.         for (i = 1; i <= count; i++){
    9.             dave = eval("document.pc_app.F_PROF_"+i) ;
    10.             if (dave[0].checked || dave[1].checked || dave[2].checked || dave[3].checked){
    11.                 complete = "T" ;
    12.             }else{
    13.             message = message + (i + " ") ;
    14.             error = "Y" ;
    15.             }
    16.         }
    17.         for (i = 1; i <= count; i++){
    18.             dave1 = eval("document.pc_app.F_PROF_"+i) ;
    19.             if (dave1[3].checked){
    20.                 acc_count = acc_count + 1 ;
    21.             }
    22.         }
    23.         if (acc_count == count){
    24.             complete = "F" ;
    25.             text  = "You have selected 'No Access' for\nevery module. Please try again." ;
    26.         }
    27.         if (error == "Y"){
    28.             complete = "F" ;
    29.             text = ("Please select an ability profile\nfor module(s): " + message) ;
    30.         }
    31.         if (complete == "F"){
    32.             alert(text) ;
    33.             return false ;
    34.         }else{
    35.             return true ;
    36.         }
    37.     }  
    38. </script>
    does anyone else know what the semi-colons are for?

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    in JAvascript, they indicate the EOL or end of the line.... some languages live VB use the CRLF as the EOL.... most other languages use ; .....
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by davebat
    I wrote the following and removed all the ";" and it didnt error at all
    Did it work at all?

    In JS, ; is the EOL marker. Nothing magical or extra.

  6. #6
    Lively Member morrowasted's Avatar
    Join Date
    Aug 2003
    Location
    Houston, TX
    Posts
    118
    in a lot of languages they use ; , not just JS

    -morrowasted

  7. #7
    Member
    Join Date
    Jan 2003
    Posts
    44
    In JS, ; is the EOL marker
    More accurately it is a statement terminator. In JavaScript a newline is also a statement terminator. The only time a semi-colon is required is if you wanted to put two statements on the same line. e.g.,
    Code:
    x += 2; y -= 1

Posting Permissions

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



Click Here to Expand Forum to Full Width