<!DOCTYPE html> <!--[if lt IE 9]> <script type="text/javascript" src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <html> <head> <meta charset="utf-8"> <title>jQuery UI 測試</title> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/hot-sneaks/jquery-ui.css" rel="stylesheet"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script> <style> article,aside,figure,figcaption,footer,header,hgroup,menu,nav,section {display:block;} body {font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;} </style> </head> <body> 股名 (輸入 "王","創") : <input id="auto1" type="text" /> 股號 (輸入數字) : <input id="auto2" type="text" /> 股號 (輸入數字) : <input id="auto3" type="text" /> <script language="JavaScript"> $(document).ready(function(){ var stock_name=["味王", "車王電", "葡萄王", "王品", "花王", "緯創", "創意"]; var stock_id=["1203", "1533", "1707", "2727", "8906", "3231", "3443"]; var stock_id_number=[1203, 1533, 1707, 2727, 8906, 3231, 3443]; //錯誤 $("#auto1").autocomplete({source: stock_name}); $("#auto2").autocomplete({source: stock_id}); $("#auto3").autocomplete({source: stock_id_number}); }); </script> </body> </html>