日期:2014-05-16 浏览次数:20382 次
<!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=gb2312" /> <title>无标题文档</title> <script src="jquery-1.4.2.min.js"></script> <script> $(function(){ $("#abc").focus(); }); </script> </head> <body> <input id="abc" type="text" /> </body> </html>
------解决方案--------------------
这个一般input标签比较明显比如
<!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>5_14</title> <script> function test(){ document.getElementById("textbox1").focus(); } </script> </head> <body onload="test()"> <input type="text" id="textbox1" /> <input type="text" id="textbox2" /> </body> </html>