|
-
Sep 25th, 2003, 03:47 AM
#1
Thread Starter
Fanatic Member
whats this
why do some lines of javascript code have ";" at the end.
-
Sep 25th, 2003, 04:59 AM
#2
Lively Member
else you get an error
it's to close the 'function'
http://www.raketje.com coming..............soon................
-
Sep 25th, 2003, 08:40 AM
#3
Thread Starter
Fanatic Member
I wrote the following and removed all the ";" and it didnt error at all
VB Code:
<script language="JavaScript">
function checker(){
var complete = "F" ;
var message = "" ;
var error = "" ;
var acc_count = 0 ;
var text = "" ;
for (i = 1; i <= count; i++){
dave = eval("document.pc_app.F_PROF_"+i) ;
if (dave[0].checked || dave[1].checked || dave[2].checked || dave[3].checked){
complete = "T" ;
}else{
message = message + (i + " ") ;
error = "Y" ;
}
}
for (i = 1; i <= count; i++){
dave1 = eval("document.pc_app.F_PROF_"+i) ;
if (dave1[3].checked){
acc_count = acc_count + 1 ;
}
}
if (acc_count == count){
complete = "F" ;
text = "You have selected 'No Access' for\nevery module. Please try again." ;
}
if (error == "Y"){
complete = "F" ;
text = ("Please select an ability profile\nfor module(s): " + message) ;
}
if (complete == "F"){
alert(text) ;
return false ;
}else{
return true ;
}
}
</script>
does anyone else know what the semi-colons are for?
-
Sep 25th, 2003, 09:03 AM
#4
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 ; .....
-
Sep 27th, 2003, 09:28 AM
#5
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.
-
Sep 27th, 2003, 04:29 PM
#6
Lively Member
in a lot of languages they use ; , not just JS

-morrowasted
-
Oct 4th, 2003, 05:39 PM
#7
Member
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.,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|