posts - 165, comments - 198, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          2008年12月13日


          學習就從官方的測試開始,但不知道怎么回事官方的測試有問題,這我就把我配置的簡單junit環境共享給大家把!
          1.下載 hibernate-annotations-3.4.0.GA 并解壓 ,cd 到解壓后目錄下
          2. $>ant junit (天知道,怎么官方出的東西測試不能通過!!)
          ?? 不要急,我們來看錯誤 (錯誤提示有刪減)
          ???? 錯誤-1:$>build.xml:95: ./jdbc not found.
          ???? 解決辦法-1: $>mkdir ./jdbc
          3.? $>ant junit
          ???? 錯誤-2:?
          ????? ./build.xml:124: The following error occurred while executing this line:
          ????? ./build.xml:126: The following error occurred while executing this line:
          ????? ./common-build.xml:349: .\src\filters\hsqldb.filter as it doesn't exist.
          ???? 解決辦法-2:
          ?????? $>mkdir? ./src/filters ;
          ?????? $>echo "" > ./src/filters/hsqldb.filter;
          4. ? $>ant junit
          ???? 錯誤-3:
          ?????? ./build.xml:124: The following error occurred while executing this line:
          ?????? ./build.xml:126: The following error occurred while executing this line:
          ?????? ./common-build.xml:351: .\src\test-resources not found.
          ????? $>mkdir? ./src/test-resources ;
          5. ? $>ant junit
          ???? 錯誤-4:沒有ant 錯誤了!,但測試都為錯誤,那我們就看看 第一個測試吧,找下原因!
          ???????? test-resources:
          ????????? [mkdir] Created dir: hibernate-anntations-3.4.0.GA\build\test-reports\hsqldb
          ????????? [echo] Running against db: hsqldb
          ????????? [junit] Running org.hibernate.test.annotations.ConfigurationTest
          ????????? [junit] Tests run: 7, Failures: 0, Errors: 6, Time elapsed: 1.218 sec
          ????????? .............
          ???? $>find . -name "ConfigurationTest.java"? #pwd /hibernate-anntations-3.4.0.GA
          ??????? ./test/org/hibernate/test/annotations/configuration/ConfigurationTest.java
          ??????? ./test/org/hibernate/test/annotations/ConfigurationTest.java
          ????? 根據路徑 org.hibernate.test.annotations.ConfigurationTest
          ????? gvim? ./test/org/hibernate/test/annotations/ConfigurationTest.java
          ????? 發現第20行: cfg.configure( "org/hibernate/test/annotations/hibernate.cfg.xml" );
          ????? 感覺應該沒有配置 jdbc
          ????? gvim ./test/org/hibernate/test/annotations/hibernate.cfg.xml? #果然 沒配置
          ????? 我這就放個我的簡單配置上來(使用 hbm hsqldb 內存數據庫測 試 ):
          <!DOCTYPE?hibernate-configuration?PUBLIC
          ????????"-//Hibernate/Hibernate?Configuration?DTD?3.0//EN"
          ????????"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
          >
          <hibernate-configuration>
          ??
          <session-factory>
          ????????
          <property?name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
          ????????
          <property?name="connection.driver_class">org.hsqldb.jdbcDriver</property>
          ????????
          <property?name="connection.url">jdbc:hsqldb:mem:hbn_ann</property>
          ????????
          <property?name="connection.username">sa</property>
          ????????
          <property?name="connection.password"></property>
          ???
          ????????
          <mapping?resource="org/hibernate/test/annotations/Boat.hbm.xml"/>
          ????????
          <mapping?package="org.hibernate.test.annotations"/>
          ????????
          <mapping?class="org.hibernate.test.annotations.Plane"/>
          ??
          </session-factory>
          </hibernate-configuration>


          ????? 我這就是要hsqldb吧,既然上面錯誤1有 jdbc 文件夾,那就是放 jdbc jar 的地方
          ????? $> cp ../hsqldb.jar? ./jdbc
          ???
          6. ? $>ant junit
          ???? 呵呵 測試 第一個正確了 ! (目前配置后,測試環境并不是全部都正確,比如第2個測試)
          ???? 其他測試錯誤日志在??? .\build\test-reports\hsqldb ...
          ???? 比如第2個錯誤 異常部分
          ????? org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.
          ??? at org.hibernate.dialect.Dialect.instantiateDialect(Dialect.java:256)
          ??? at org.hibernate.dialect.Dialect.getDialect(Dialect.java:234)
          ??????? ........ 大家一邊學習,一邊配置測試 環境吧。
          ??? 錯誤日記 都會在 build\test-reports\hsqldb下

          posted @ 2009-04-14 11:30 G_G 閱讀(1677) | 評論 (0)編輯 收藏


          參考:
          http://tech.ddvip.com/2008-12/122835390597191.html


          頁面可以直接運行:
          <html>
          <head>

          <style?type="text/css">

          .box1
          {
          float
          :left;
          width
          :21px;
          height
          :21px;
          position
          :relative;
          background
          :?#F3F2E2?url(http://mp3.youdao.com/images/mbox_bg.gif)?no-repeat;
          }
          .box1?
          {
          background-position
          :?0px?-60px;
          }


          </style>

          </head>

          <body>

          ????
          <div?class="box1"?
          ????????onmouseover
          ="this.style.backgroundPosition='0px?-81px'?"?
          ????????onmouseout
          ="this.style.backgroundPosition='0px?-102px'?"????
          ????
          >
          ????
          </div>

          </body>

          </html>

          posted @ 2009-02-24 16:46 G_G 閱讀(1996) | 評論 (0)編輯 收藏

          javascript 學習
          ?? ? ? javascript 大體上可分為3個不同部分組成: 核心(ECMAscript),文本對象(DOM),瀏覽器對象(BOM)
            1. ?核心(ECMAscript): 關鍵字,語句,運算符,對象
            2. 文本對象(DOM):DOM將把整個頁面規劃成由節點層級構成的文檔.
              1. 解析遵循 W3C html dom 標準
              2. ? W3C dom 參考特別關注 DOM Node 說明???
            3. BOM 瀏覽器對象.? cookie,彈出新瀏覽器,瀏覽器設置大小
          ?
          核心(ECMAscript)Global 內置對象;
          ????? 方法: parseInt(),isNan(),encodeURI()...等都為此對象方法
          ????? 特別注意 eval();動態語言的象征 比如:eval("alert('hi')"); 但這個方法很邪惡(安全方面)
          文本對象(DOM)說明:
          ?? ??? ?
          <bookstore>
          <book category="cooking">
          <title lang="en">Everyday Italian</title>
          <author>Giada De Laurentiis</author>
          <year>2005</year>
          <price>30.00</price>
          </book>
          </bookstore>

          DOM node tree

          Node tree

          ?? ??? ??? ???


          ??? ?

          ? 1. ECMAscript基礎

          ?????? $ 變量弱類型 ; ??? 匈牙利類型標示 : var iOuouValue=100;?

          ?????? $ 結束行分號有無都可以; ??? 但再 onsubmit="javascript:function();return false;"

          ?????? $ 關鍵字 ; 提別注意

          ??????????????? "constructor" bean.constructor

          ???????????????????? //print bean function(){

          ????????????????????????? ....

          ????????????????????? }

          ??????????????? "typeof" ? var test=1; alert(typeof testX); //output "undefined"

          ??????????????? "NaN" - not a number ->? isNan("blue"); //output "true" ? ->isNan("123"); //output "false"?

          ?????? $ 對象; var o = new Object(); var a = {}?

          ?? ??? ??? ??? ?這里特別說明下 我們普通寫的 一個 function 就是一個 object?

          ?? ??? ??? ?? 這?? var a = {name:"劉凱毅"} 等同與 var a = function(){this.name="劉凱毅"};

          ?? ??? ??? ??? ???? 來個 {name:"test",pass:"123456",addr:"bj"} //這是什么 ?! json

          ?? ??? ??? ???????? 當 var str = '{name:"test",pass:"123456",addr:"bj"}'

          ?? ??? ??? ??? ???? var objectBean = eval(str); //這里就是 對象 objectBea.name 使用了

          ? 域概念:

          <SCRIPT type=text/javascript>
          var sMessage = 'Hello';
          function setSomething() {
          ? sColor = 'red';
          ? sMessage = 'Hello World!';
          }
          setSomething();
          alert(sMessage); //Hello World!
          alert(sColor); //red
          </SCRIPT>
          <SCRIPT type=text/javascript>
          var sMessage = 'Hello';
          function setSomething() {
          ? var sColor = 'red';
          ? sMessage = 'Hello World!';
          }
          setSomething();
          alert(sMessage); //Hello World!
          alert(sColor); // 什么都沒有
          </SCRIPT>

          <SCRIPT type=text/javascript>
          var sMessage = 'Hello';
          function setSomething() {
          ? var sColor = 'red';
          ? var sMessage = 'Hello World!';
          }
          setSomething();
          alert(sMessage); //Hello
          alert(sColor); // 什么都沒有
          </SCRIPT>

          ??????????

          為面向對象做基礎:object prototype 類型的對象應用。參考

          // 最簡單的 繼承
          Object.prototype.inObj?=?1;

          function?A()
          {
          ????this.inA?=?2;
          }
          ?
          A.prototype.inAProto?=?3;
          ?
          B.prototype?=?new?A;????????????//?Hook?up?A?into?B's?prototype?chain
          B.prototype.constructor?=?B;
          function?B()
          {
          ????this.inB?=?4;
          }
          ?
          B.prototype.inBProto?=?5;
          ?
          x?=?new?B;
          document.write(x.inObj?+?',?'?+?x.inA?+?',?'?+?x.inAProto?+?',?'?+?x.inB?+?',?'?+?x.inBProto);

          //1, 2, 3, 4, 5
          //增加點信心 http://www.json.org/json.js
          Object.prototype.toJSONString = function (filter) {
          return JSON.stringify(this, filter);
          };
          后我們就可以使用 bean.toJSONString()不是嗎?

          ??? $ arguments ;

          ???????? function getFun(){alert(arguments.length);}?? ;

          ?

          ?? ??? ??? ??? ?getFun("xx") //output 1

          ?? ??? ??? ??? ?getFun("xx",23) //output 2



          ?? $ 語句 ;特殊說明下 for?

          ?????????? for(var i=0i<iCount;i++)?? 或 for( attr in object ) ;

          ?????????? 如果無聊 你可以 for( sProp in window ){alert(sProp+"你丫點啊!");} //看看 javascript 的反射

          ??????????????

          ? ? ? ? ? ? ? ??

          ???


          面向對象:

          ? var bean = new Bean();

          ??

          ? 1.工廠方法

          ??????? ??? function getAttr(){

          ???? ?? ??? ???? alert(this.attr)

          ??????????? }

          ??????????? function Bean(tattr){

          ?? ??? ??? ???? var bean = new Object;

          ?? ??? ??? ?????bean.attr = tattr;

          ?? ??? ??? ?????bean.getAttr = getAttr;

          ?? ??? ??? ???? return bean ;

          ??????????? }

          ?? ???? 根本就是山寨版 面向對象

          ? 2.構造

          ????? ??? function Bean(tattr){

          ?? ??? ?????? this.attr = tattr ;

          ?? ??? ??? ?? bean.getAttr = function(){

          ?? ??? ??? ?????alert(this.attr);

          ?? ??? ??? ? ?} ? ?

          ?? ??? ???}

          ?? 其上 2 總 再Bean 對象創建時,方法會 “重復生成函數”!


          ? 3.原型模式

          ??? function Bean(){}

          ??? Bean.prototype.attr = "";

          ??? Bean.prototype.getAttr=function(){alert(this.attr);}

          ?? ?

          ?? 解決 “重復生成函數” 問題,但新的問題 Bean.prototype.getArray = new Array();


          ?? 其 new 對象 bean1 和 bean2 都會共享 new Array 空間(是我們不想看到的)


          ? 4.混合 模型 :)? 哈哈

          ???? function Bean(){

          ?? ??? ?this.attr= "";

          ?? ??? ?this.getArray=new Array;

          ?? ?}

          ?? ?Bean.prototype.getAttr=function(){alert(this.attr);}

          ?

          ? 5.動態原型 (注意下面開始,就是真正的面向對象!!!)

          ?? ??? function Bean(){

          ?? ???? this.attr= "";
          ?? ??? ?this.getArray=new Array;

          ?? ???? //classload 加載 時

          ?? ???? if(typeof Bean._initialized == "undefined" ){

          ?? ??? ???? Bean.prototype.getAttr=function(){alert(this.attr);};

          ?? ???? ??? Bean._initialized= true ;

          ?? ??? ?}

          ???? }

          ???

          /****************************************************************/

          對象繼承

          ? 1.對象冒充!!(可支持多繼承,山寨很強大)

          ????? function classA(sstr){

          ?? ???? this.color = sstr ;

          ?? ???? this.sayColor = function(){

          ?? ??? ???? alert(this.color);

          ?? ??? ?};

          ?? ???}

          ?? ?? function classC(){}

          ?? ??? function classB(){

          ?? ??? ???? this.newMethod =ClassA ;

          ?? ??? ???? this.newMethod();

          ?? ??? ???? delete this.newMethod ;


          ?? ??? ???? this.newMethod =ClassC ;

          ?? ??? ???? this.newMethod();

          ?? ??? ???? delete this.newMethod ;

          ?? ??? ????

          ?? ??? ???? this.arrt = "google";

          ?? ??? ?}

          ?? ?

          ? 2.call() apply() 也山寨,

          ????? function classA(sstr){

          ?? ???? this.color = sstr ;

          ?? ???? this.sayColor = function(str){

          ?? ??? ???? alert(str+this.color);

          ?? ??? ?};

          ?? ???}

          ?? ??? function classB(){

          ?? ??? ??? // this.newMethod =ClassA ;

          ?? ??? ??? // this.newMethod();

          ?? ??? ??? // delete this.newMethod ;

          ?? ??? ???? classA.call(this,"red");

          ?? ??? ???? //classA.apply(this,new Array("red"))

          ?? ??? ???? this.arrt = "baidu";

          ?? ??? }


          3.正統的繼承 原型鏈 (但不支持多繼承)
          ??? function classA(){this.oo="test";}
          ??? classA.prototype.color = "red";
          ??? function classB(){}
          ??? classB.prototype = new classA ;
          ??? classB.prototype.sayName = function(){
          ?? ???? alert( this.color );
          ?? ?}
          ?? ?
          var bb = new classB ;
          ?? ?bb.sayName();
          // output red
          ?? ?
          alert(bb.oo); // output test

          ?? ?alert( bb instanceof classA); //output true
          ?? ?alert( bb instanceof classB); //output? true

          4.如果你要多繼承!!并且還支持 instanceof
          ?? ???? 混合方式:
          ?? ???? function classA(){}
          ?? ???? function classB(){}
          ?? ???? function classC(){
          ?? ??? ???? classA.call(this);
          ?? ??? ???? classC.call(this);
          ?? ??? ?}
          ?? ???? classC.prototype = new classA ;//注意 這
          instanceof 只能對 A有用

          ?? ??? ?






          ???

          posted @ 2009-02-12 11:56 G_G 閱讀(1842) | 評論 (2)編輯 收藏



          下載:flash-plugin-10.0.15.3-release.i386.rpm

          ?rpm -ivh flash-plugin-10.0.15.3-release.i386.rpm

          posted @ 2009-01-12 23:39 G_G 閱讀(747) | 評論 (0)編輯 收藏


          tomcat > server.xml

          ????? <Host name="localhost" appBase="webapps"
          ?????? unpackWARs="true" autoDeploy="true"
          ?????? xmlValidation="false" xmlNamespaceAware="false">

          ? <Context docBase="D:/workspace/meganotes/mn_mod_admin/target/mn_mod_admin/" path="/"? />

          。。。。


          關鍵:在Context上不要加reloadable和debug屬性
          ?然后 使用eclipse tomcat 調試
          ok

          posted @ 2008-12-26 17:52 G_G 閱讀(536) | 評論 (0)編輯 收藏


          <? xml?version="1.0"?encoding="UTF-8" ?>
          < project? name ="ssh" >
          ????
          < property? file ="ssh.properties" ? />
          ????
          < tstamp >
          ????????
          < format? property ="TODAY" ?pattern ="yyyyMMddHHmm" ? />
          ????
          </ tstamp >
          ????
          < property? name ="ssh.path" ?value ="/data/meganotes/shell/" ? />


          ????
          < target? name ="shell/?文件?上載/覆蓋" >
          ????????
          < input? addproperty ="scp_coverage_shell_file"
          ????????????message
          ="輸入(ssh/?下文件名?\n\r?上載或覆蓋?到服務器?218?${ssh.path}?):" >
          ????????
          </ input >
          ????????
          < input
          ????????????
          message ="請確定是否使用?ssh/${scp_coverage_shell_file}?覆蓋服務器中?${ssh.host}:${ssh.path}${scp_coverage_shell_file}?(y,n)"
          ????????????validargs
          ="y,n" ?addproperty ="do.coverage" ?defaultvalue ="n" ? />
          ????????
          < condition? property ="do.abort" >
          ????????????
          < equals? arg1 ="n" ?arg2 ="${do.coverage}" ? />
          ????????
          </ condition >
          ????????
          < fail? if ="do.abort" > 退出 </ fail >

          ????????
          < sshexec? host ="${ssh.host}" ?username ="${ssh.myName}"
          ????????????password
          ="${ssh.myPass}" ?trust ="true"
          ????????????command
          ="
          ????????????????????mkdir?-p?${ssh.path}backup/${TODAY}?;
          ????????????????????if?[?-f?${ssh.path}${scp_coverage_shell_file}???]?;
          ????????????????????then??
          ????????????????????????cp?${ssh.path}${scp_coverage_shell_file}?${ssh.path}backup/${TODAY}/?;
          ????????????????????fi?;
          ????????"
          >
          ????????
          </ sshexec >
          ????????
          < scp? file ="ssh/${scp_coverage_shell_file}"
          ????????????todir
          ="${ssh.myName}:${ssh.myPass}@${ssh.host}:${ssh.path}"
          ????????????trust
          ="true" ?verbose ="true" ? />

          ????????
          < sshexec? host ="${ssh.host}" ?username ="${ssh.myName}"
          ????????????password
          ="${ssh.myPass}" ?trust ="true"
          ????????????command
          ="chmod?777?${ssh.path}${scp_coverage_shell_file}" >
          ????????
          </ sshexec >
          ????
          </ target >

          ????
          < target? name ="shell/?文件查看" >
          ????????
          < input? addproperty ="show_shell_file" ?message ="輸入查看文件名(*sh):"
          ????????????defaultvalue
          ="*" >
          ????????
          </ input >
          ????????
          < sshexec? host ="${ssh.host}" ?username ="${ssh.myName}"
          ????????????password
          ="${ssh.myPass}" ?trust ="true"
          ????????????command
          ="ls??/data/meganotes/shell/${show_shell_file}" >
          ????????
          </ sshexec >
          ????
          </ target >

          ????
          < target? name ="shell/?文件拷貝" >
          ????????
          < input? addproperty ="scp_shell_file"
          ????????????message
          ="輸入?/data/meganotes/shell/?下需要文件名(cp?到?ssh?下):" >
          ????????
          </ input >
          ????????
          < scp
          ????????????
          file ="${ssh.myName}:${ssh.myPass}@${ssh.host}:/data/meganotes/shell/${scp_shell_file}"
          ????????????todir
          ="ssh" ?trust ="true" ?verbose ="true" ? />
          ????
          </ target >



          ????
          < target? name ="admin-mvn組合操作" >
          ????????
          < exec? executable ="cmd" >
          ????????????
          < arg? value ="/c" ? />
          ????????????
          < arg? value ="${basedir}/sh/mvn/meganotes_mvn_clear.bat" ? />
          ????????
          </ exec >
          ????????
          < exec? executable ="cmd" >
          ????????????
          < arg? value ="/c" ? />
          ????????????
          < arg? value ="${basedir}/sh/mvn/meganotes_mvn_install.bat" ? />
          ????????
          </ exec >
          ????????
          < exec? executable ="cmd" >
          ????????????
          < arg? value ="/c" ? />
          ????????????
          < arg? value ="${basedir}/sh/mvn/mn_mod_admin_mvn_intall.bat" ? />
          ????????
          </ exec >
          ????
          </ target >


          ????
          < target? name ="admin-tomcat日志" >
          ????????
          < sshexec? host ="${ssh.host}" ?username ="${ssh.myName}"
          ????????????password
          ="${ssh.myPass}" ?trust ="true" ?command ="${ssh.adminRunLog}" >
          ????????
          </ sshexec >
          ????
          </ target >

          ????
          < target? name ="schedule-tomcat日志" >
          ????????
          < sshexec? host ="${ssh.host}" ?username ="${ssh.myName}"
          ????????????password
          ="${ssh.myPass}" ?trust ="true"
          ????????????command
          ="${ssh.scheduleRunLog}" >
          ????????
          </ sshexec >
          ????
          </ target >
          ????
          < target? name ="查找2008/下Mp3沒轉128-64文件夾" >
          ????????
          < sshexec? host ="${ssh.host}" ?username ="${ssh.myName}"
          ????????????password
          ="${ssh.myPass}" ?trust ="true" ?command ="${ssh.64k}" >
          ????????
          </ sshexec >
          ????????
          < sshexec? host ="${ssh.host}" ?username ="${ssh.myName}"
          ????????????password
          ="${ssh.myPass}" ?trust ="true" ?command ="${ssh.128k}" >
          ????????
          </ sshexec >
          ????????
          < sshexec? host ="${ssh.host}" ?username ="${ssh.myName}"
          ????????????password
          ="${ssh.myPass}" ?trust ="true"
          ????????????command
          ="${ssh.128kto64k.err}" >
          ????????
          </ sshexec >
          ????
          </ target >

          ????
          < target? name ="admin模塊測試" >
          ????????
          < input? addproperty ="admin_test_input"
          ????????????message
          ="測試類輸入(Video*Test):" ?defaultvalue ="*Test" >
          ????????
          </ input >
          ????????
          < echo? message ="${admin_test_input}" ></ echo >
          ????????
          < exec? executable ="cmd" >
          ????????????
          < arg? value ="/c" ? />
          ????????????
          < arg
          ????????????????
          value ="${basedir}/sh/admin_test.bat?${admin_test_input}?" ? />
          ????????
          </ exec >
          ????
          </ target >
          </ project >

          posted @ 2008-12-24 16:24 G_G 閱讀(6392) | 評論 (3)編輯 收藏





          ???? public ? static ? void ?main(String[]?args)? {
          ????????
          try ? {
          ????????
          ?????????String?charset?
          = ? " UTF-8 " ;
          ?????????String?outfile?
          = ? " d:\\category.20081218.gz " ;
          ?????????BufferedReader?in?
          = ? new ?BufferedReader(
          ??????????
          new ?InputStreamReader(
          ??????????
          new ?FileInputStream( " d:\\category.20081218 " ),
          ??????????charset));
          ??????????
          ??????????BufferedOutputStream?out?
          =
          ????????????
          new ?BufferedOutputStream(
          ??????????????
          new ?GZIPOutputStream(
          ????????????????
          new ?FileOutputStream(outfile)));
          ??????????
          ??????????
          ??????????System.out.println(
          " Writing?file " );
          ??????????String?c;
          ??????????
          while ((c? = ?in.readLine()) != null )
          ????????????out.write(?(c
          + " \n " ).getBytes(charset));
          ??????????in.close();
          ??????????out.close();
          ??????????System.out.println(
          " Reading?file " );
          ??????????BufferedReader?in2?
          =
          ????????????
          new ?BufferedReader(
          ??????????????
          new ?InputStreamReader(
          ????????????????
          new ?GZIPInputStream(
          ??????????????????
          new ?FileInputStream(outfile)
          ??????????????????),charset
          ????????????????)
          ??????????????);
          ??????????String?s;
          ??????????
          while ((s? = ?in2.readLine())? != ? null )
          ????????????System.out.println(s);
          ????????}
          ? catch (Exception?e)? {
          ??????????e.printStackTrace();
          ????????}

          ??????}


          posted @ 2008-12-22 14:35 G_G 閱讀(3623) | 評論 (0)編輯 收藏



          官方上下
          http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/

          $.補全中文? 修改
          ??? jquery.autocomplete.js 中
          ??? $input.bind(($.browser.opera ? "keypress" : "keydown")
          ??? 改為
          ??? $input.bind(($.browser.opera ? "keypress" : "keyup")
          ????
          $. 在 localdata.js 》》 var cities = [..?
          ?? 中放些 中文 測試吧


          測試頁面 ,最簡單的使用頁面 。(應該算是最簡單補全測試了)
          <script?type="text/javascript"?src="../lib/jquery.js"></script>
          <script?type='text/javascript'?src='../jquery.autocomplete.js'></script>

          <link?rel="stylesheet"?type="text/css"?href="../jquery.autocomplete.css"?/>
          <script?type="text/javascript">
          $().ready(
          function()?{
          ????$(
          "#suggest1").autocomplete([
          ????
          "test1",
          ????
          "test2",
          ????
          "測試1",
          ???????
          "測試2"
          ????]);
          });
          </script>

          <input?type="text"?id="suggest1"?/>



          使用json

          <script?type="text/javascript"?src="../lib/jquery.js"></script>
          <script?type='text/javascript'?src='../jquery.autocomplete.js'></script>

          <script?type='text/javascript'?src='localdata.js'></script>
          <link?rel="stylesheet"?type="text/css"?href="../jquery.autocomplete.css"?/>
          <script?type="text/javascript">
          var?emails?=?[
          ????{?name:?
          "Peter?Pan",?to:?"peter@pan.de"?},
          ????{?name:?
          "Molly",?to:?"molly@yahoo.com"?},
          ????{?name:?
          "Forneria?Marconi",?to:?"live@japan.jp"?},
          ????{?name:?
          "Master?<em>Sync</em>",?to:?"205bw@samsung.com"?},
          ????{?name:?
          "Dr.?<strong>Tech</strong>?de?Log",?to:?"g15@logitech.com"?},
          ????{?name:?
          "Don?Corleone",?to:?"don@vegas.com"?},
          ????{?name:?
          "Mc?Chick",?to:?"info@donalds.org"?},
          ????{?name:?
          "Donnie?Darko",?to:?"dd@timeshift.info"?},
          ????{?name:?
          "Quake?The?Net",?to:?"webmaster@quakenet.org"?},
          ????{?name:?
          "Dr.?Write",?to:?"write@writable.com"?}
          ]


          $().ready(
          function()?{
          ????????$(
          "#suggest13").autocomplete(emails,?{
          ????????
          //補全中選擇顯示
          ????????formatItem:?function(row,?i,?max)?{
          ????????????
          return?i?+?"/"?+?max?+?":?\""?+?row.name?+?"\"?["?+?row.to?+?"]";
          ????????????},
          ????????
          //補全匹配格式
          ????????formatMatch:?function(row,?i,?max)?{
          ????????????
          return?row.name?;
          ????????????},
          ????????
          //補全選定后顯示
          ????????formatResult:?function(row)?{
          ????????????
          return?row.to;
          ????????}
          ????})
          });
          </script>




          posted @ 2008-12-13 09:41 G_G 閱讀(1115) | 評論 (1)編輯 收藏

          主站蜘蛛池模板: 惠水县| 永吉县| 横峰县| 安阳县| 周至县| 小金县| 城口县| 阜南县| 土默特左旗| 鹰潭市| 社会| 陆河县| 辽阳县| 阜康市| 北安市| 延庆县| 汉寿县| 和静县| 蒙自县| 盐池县| 临朐县| 西林县| 兰州市| 台东县| 长子县| 滕州市| 汤阴县| 宜昌市| 肇庆市| 和田县| 陇川县| 永胜县| 云安县| 孝昌县| 静安区| 金塔县| 陇川县| 奉新县| 昌吉市| 鹰潭市| 太原市|