<div class="codetitle"> <span><a style="CURSOR: pointer" data="47919" class="copybut" id="copybut47919" onclick="doCopy('code47919')"><u>复代码码</u></a></span> 代码如下:</div> <div class="codebody" id="code47919"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 전환//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3.org/1999/xhtml"> <br><머리> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <br><title>无标题文档</title> <br><script type="text/javascript" src="jquery-1.7.1.min.js"></script> <br><script type="text/javascript"> <br>var sayHello=function(){ <br>alert("Hello,World!"); <br>} <br><br>$(function(){ <br>sayHello(); <br>$('option[value=0]').attr('selected','selected'); <br>$('select').change(sayHello) <br>}) <br><br></script> <br></head> <br><본문> <br><select name="sel"> <br><option value="0">1</option> <br><option value="1">두</option> <br><option value="2">3</option> <br></select> <br></body> <br></html> <br> </div> <br>이번에는 매우 현대적인 유형이 사용되었습니다.立调用时,写法是有区别的,前者不附加(),而后者必须加()。