What is the point or meaning behind having code that has open and closes parentheses?
Here's the sample code that I'm looking at:
<input style="background-color:#bfdfff" name="fn" type="te开发者_如何转开发xt" id="kfn"
size="55" maxlength="55" onfocus=
"this.select();
if (this.value==''){
this.style.background='#00CCCC';
}
else
{
this.style.background='#99CCFF';
}
" />
The line I'm curious about is here:
this.select();
What's the meaning of using open and close brackets ()
?
THose are called parentheses, not "brackets". They enclose the arguments to a function call. The function select
doesn't take any arguments, but you still have to put the parentheses there to call the function.
Adding to what ernest said, it also helps to identify a function rather than just a variable. Without the parentheses you would have no idea if something was a function or a variable if you were unfamiliar with the code.
精彩评论