Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> untitled document </title>
<Script type = "text/javascript" src = "jquery-1.7.1.min.js"> </script>
<Script type = "text/javascript">
Var sayHello = function (){
Alert ("Hello, World! ");
}
$ (Function (){
SayHello ();
$ ('Option [value = 0] '). attr ('selected', 'selected ');
$ ('Select'). change (sayHello );
})
</Script>
</Head>
<Body>
<Select name = "sel">
<Option value = "0"> one </option>
<Option value = "1"> two </option>
<Option value = "2"> three </option>
</Select>
</Body>
</Html>
The code above implements multiple calls to a function. It is worth noting that when a function is used as a parameter of other functions and is called independently, the writing method is different. The former does not need to append (), while the latter must add ().