开发者

What's the meaning behind open and closed parentheses?

开发者 https://www.devze.com 2023-02-23 05:25 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消