<html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $(":text").val("Hello Kitty"); }); }); </script> </head> <body> <p>Name: <input type="text" name="user" value="Hello World" /></p> <button>改变文本域的值</button> </body> </html>
当点击按钮的时候,文本的内容将会变为Hello Kitty!
时间: 2024-10-17 06:44:32