推奨:ASP 3.0高度なプログラミング(41) 9.2.3ストアドプロシージャの使用ストアドプロシージャの使用は、コマンドオブジェクトが適用される領域です。ストアドプロシージャ(ストレージクエリと呼ばれることもあります)は、データベースで事前に定義されているSQLクエリステートメントです。コードで直接使用する代わりに、ストアドプロシージャを作成して使用する必要があるのはなぜですか
これは、ASP、VBScript、JavaScriptで書かれた単語コーディングに関するゲームです。
Win98 OEM2、PWS、およびIE5の下でテスト中に大きな問題は見つかりませんでした。
使い方:
方法1:たとえば、3Wサービスのディレクトリはc:/inetpub/wwwrootです。WordaSBなどのディレクトリを作成します。ゲームファイル(wordasb.asp)をディレクトリにコピーします。 http://マシン名/wordasb/wordasb.aspまたはhttp://127.0.0.1/wordasb/wordasb.aspのIEのアドレスバーにあるタイプ。
方法2:ゲームファイル(wordasb.asp)を新しく作成したディレクトリにコピーします。ディレクトリを右クリックし、メニューで[プロパティ]を選択し、[Web共有プロパティ]ページをクリックし、[このフォルダーアイテムの共有]をクリックし、[OK]をクリックします。 http://マシン名/新しいディレクトリ名/wordasb.aspまたはhttp://127.0.0.1/ IEのアドレスバーのhttp://127.0.0.1/ゲームを入力して開始します。
注:マシンOSはNTまたはWin2000サーバーまたは他のOSである必要がありますが、PWSはインストールされています
ゲーム方法:
ゲーム内のゲームの指示をクリックして知ります。ページが空白の場合は、F5を押して更新してください(これも現在最大のバグです)。
コードは次のとおりです。
| 以下は引用されたコンテンツです。 <%@言語= vbscript%> <% オプションは明示的です '2001年3月16日にReconによって最後に更新されました dim m_ipartcnt DIM M_STRPROMPT dim m_astrsenpart()、m_astrfilename() dim m_astrwords()、m_aiopstatus() '------------------------------------------------------- '定数変数説明 'M_IPARTCNT:語彙カテゴリの数。整数 'm_strprompt:ファイル操作が完了した後のプロンプト。文字列タイプ 'M_ASTRSENPART:語彙分類の名前。文字配列 'M_ASTRFILENAME:さまざまな語彙ファイルのファイル名を記録します。文字配列 'M_ASTRODES:あらゆる種類の語彙を記録します。二次元文字アレイ 'm_aiopstatus:各ファイルで操作した後のステータスを記録します。整数配列 '------------------------------------------------------- 'showmethod M_IPARTCNT = 4 M_STRPROMPT = redim m_astrsenpart(m_ipartcnt) Redim M_ASTRFILENAME(M_IPARTCNT) redim m_astrwords(m_ipartcnt) redim m_aiopstatus(m_ipartcnt) 'さまざまな語彙カテゴリの名前を定義します M_ASTRSENPART(0)=件名 M_ASTRSENPART(1)=副詞程度 M_ASTRSENPART(2)=副詞場所 M_ASTRSENPART(3)= Predicate 'さまざまな語彙文書の名前を定義します M_ASTRFILENAME(0)= who.txt M_ASTRFILENAME(1)= how.txt M_ASTRFILENAME(2)= where.txt M_ASTRFILENAME(3)= what.txt request.servervariables(request_method)= post thenの場合 'ページの要求方法が投稿されている場合 '************************* 'クライアント情報を取得します '************************* DIM M_ISENPART DIM M_STROPWAY dim m_brpteddata '------------------------------------------------------- '定数変数説明 'M_ISENPART:語彙分類を表す数字。整数 '語彙分類は、配列M_ASTRSENPARTからのものです '可能な値は次のとおりです。 '0:件名 '1:副詞程度 '2:副詞の場所 '3:述語 'M_Stropway:ファイル操作方法。文字列タイプ '可能な値は次のとおりです。 '1。保存:特定の種類の語彙をファイルに保存します '2。SaveAll:すべてのカテゴリの語彙をファイルに保存します '3。ロード:ファイルから特定の種類の語彙をロードする '4。Loadall:ファイルから語彙のすべてのカテゴリをロードする 'm_brptedData:今回提出されたフォームデータが前回と同じかどうかを示します。ブールタイプ '可能な値は次のとおりです。 '1。 FALSE:フォームデータは複製されていません '2。true:フォームデータが繰り返されます(つまり、フォームが繰り返し提出されます) '------------------------------------------------------- 'showform 'ユーザーリクエストを取得する方法 m_stropway = request.form(txtopway) 'ショー(M_Stropway) 'さまざまなカテゴリで単語を取得します M_ICOUNT = 0から(M_IPARTCNT -1)の場合 if request.form(txtwords&m_icount)then m_astrwords(m_icount)= split(request.form(txtwords&m_icount)、、) ifを終了します 'Response.write ubound(m_astrwords(m_icount))&<br> 次 'フォームの繰り返し提出の検出 'session(forminf)= request.formの場合 ''フォームは繰り返されます 'm_brpteddata = true 'それ以外 ''フォームは繰り返されない提出物です 'セッション(forminf)= request.form 'm_brpteddata = false 'end if 'Show(m_brpteddata) '************************* '単語ファイルを操作します '************************* 'm_brpteddata = falseの場合 dim m_icount、m_ierrcnt DIM M_STRFILEPATH '------------------------------------------------------- '定数変数説明 'M_ICount:カウンター。整数 'm_ierrcnt:操作が失敗した回数。整数 'm_strfilepath:さまざまな語彙ファイルのパスを記録します。文字列タイプ '------------------------------------------------------- '語彙ファイルを配置するパスを取得します m_strfilepath = request.servervariables(path_translated) m_strfilepath = left(m_strfilepath、instrrev(m_strfilepath、 /)) 'm_strfilepath = m_strfilepath&words/ 'Show(m_strfilepath) 'ファイル操作を開始します 'Response.Writeは単語ファイルの操作を開始します<br> ケースM_STROPWAYを選択します ケースセーブ 'ファイルに単語を保存します m_isenpart = cint(request.form(txtsenpart)) m_aiopstatus(m_isenpart)= savefile(m_isenpart) '操作ステータスによると、迅速な情報を取得します ケースm_aiopstatus(m_isenpart)を選択します ケース0 M_STRPROMPT = [&M_ASTRSENPART(M_ISENPART)&]いくつかの単語がファイルに正常に保存されました ケース1 M_STRPROMPT = [&M_ASTRSENPART(M_ISENPART)&]いくつかのファイルを保存するに失敗しました [選択]を終了します saveall 'すべてのカテゴリの単語をファイルに保存します m_ierrcnt = 0 M_ICOUNT = 0から(M_IPARTCNT -1)の場合 m_aiopstatus(m_icount)= savefile(m_icount) m_aiopstatus(m_icount)= 1の場合 m_ierrcnt = m_ierrcnt 1 ifを終了します 次 '操作ステータスによると、迅速な情報を取得します ケースm_ierrcntを選択します ケース0 M_STRPROMPT =すべてのカテゴリの単語がファイルに正常に保存されました ケースM_IPARTCNT M_STRPROMPT =すべてのカテゴリの単語ファイルは保存できませんでした ケース他のケース m_strprompt = where、 M_ICOUNT = 0から(M_IPARTCNT -1)の場合 m_aiopstatus(m_icount)= 1の場合 M_STRPROMPT = M_STRPROMPT&[&M_ASTRSENPART(M_ICOUNT)&]、 ifを終了します 次 m_strprompt = left(m_strprompt、len(m_strprompt)-1) M_STRPROMPT = M_STRPROMPTおよび一部のファイルは保存できませんでした [選択]を終了します ケース負荷 'ファイルから単語を読み込みます m_isenpart = cint(request.form(txtsenpart)) m_aiopstatus(m_isenpart)= loadfile(m_isenpart) '操作ステータスによると、迅速な情報を取得します ケースm_aiopstatus(m_isenpart)を選択します ケース0 M_STRPROMPT = [&M_ASTRSENPART(M_ISENPART)&]いくつかの単語が正常にロードされています ケース1 M_STRPROMPT = [&M_ASTRSENPART(M_ISENPART)&]一部のファイルは存在せず、ロードが失敗します [選択]を終了します ケースロードオール '各ファイルから単語を読み込みます m_ierrcnt = 0 M_ICOUNT = 0から(M_IPARTCNT -1)の場合 m_aiopstatus(m_icount)= loadfile(m_icount) m_aiopstatus(m_icount)= 1の場合 m_ierrcnt = m_ierrcnt 1 ifを終了します 次 '操作ステータスによると、迅速な情報を取得します ケースm_ierrcntを選択します ケース0 M_STRPROMPT =すべてのカテゴリの単語が正常にロードされています ケースM_IPARTCNT m_strprompt =すべてのカテゴリの単語ファイルは存在せず、ロードは完全に失敗します ケース他のケース m_strprompt = where、 M_ICOUNT = 0から(M_IPARTCNT -1)の場合 m_aiopstatus(m_icount)= 1の場合 M_STRPROMPT = M_STRPROMPT&[&M_ASTRSENPART(M_ICOUNT)&]、 ifを終了します 次 m_strprompt = left(m_strprompt、len(m_strprompt)-1) M_STRPROMPT = M_STRPROMPTおよび一部のファイルは存在しません、いくつかのロードが失敗します [選択]を終了します [選択]を終了します 'end if ifを終了します 'response.word files <br>を操作するために終了します 'Response.Writeクライアントページを書き始めます<br> %> html> <ヘッド> <タイトル>ワードマッチングゲーム</タイトル> <メタ名=ジェネレーターコンテンツ= editplus> <メタ名=著者コンテンツ=> meta name = keywords content => <メタ名=説明コンテンツ=> <! - スタイルテーブル - > <スタイル> <! - /*英語フォント1*/ .fonteng1 { フォントファミリー:タイムズニューローマ。 フォントスタイル:; } /*英語フォント2*/ .fonteng2 { フォントファミリー:タイムズニューローマ。 フォントスタイル:イタリック; } /*fontに付着*/ .fontemp { 色:赤; } /*リンク*/ 。リンク { フォントファミリー:タイムズニューローマ。 フォントスタイル:イタリック; テキスト装置:なし; } /*表示された単語のリスト*/ .listshown { 位置:絶対; 幅:140px; 高さ:200px; 表示:インライン; 境界線:lightcoral 1px solid; バックグラウンドカラー:ゲインズボロ。 } /*非表示の単語リスト*/ .listHidden { 位置:絶対; 幅:140px; 高さ:200px; 表示:なし; 境界線:lightcoral 1px solid; バックグラウンドカラー:ゲインズボロ。 } /*単語リストを修正*/ .listfixed { 位置:絶対; 幅:140px; 高さ:200px; 表示:インライン; 境界線:赤1px固体; バックグラウンドカラー:ゲインズボロ。 } /*ヘルプリストを表示*/ .helpshown { 位置:絶対; 幅: ; 身長: ; 表示:ブロック; 境界線:lightcoral 1px solid; バックグラウンドカラー:ゲインズボロ。 } /*非表示ヘルプリスト*/ .helphidden { 位置:絶対; 幅: ; 身長: ; 表示:なし; 境界線:lightcoral 1px solid; バックグラウンドカラー:ゲインズボロ。 } /*ピン留めヘルプリスト*/ .helpfixed { 位置:絶対; 幅: ; 身長: ; 表示:ブロック; 境界線:赤1px固体; バックグラウンドカラー:ゲインズボロ。 } /*ハイライトされたタグ*/ .lblMover { テキスト装置:なし; 色:LightCoral; 背景色:; } /*通常の表示タグ*/ .lblmout { テキスト装置:なし; 色: ; 背景色:; } /*タグをクリック*/ .lblclicked { テキスト装置:下線; 色:赤; 背景色:; } /*強調表示ボタン*/ .btnlighted { 幅:105px; 色:青; 背景色:; } /*通常の表示ボタン*/ .btndelighted { 幅:105px; 色: ; 背景色:; } /*強調表示された単語リスト項目*/ .pttrighted { テキスト装置:下線; 色:青; 背景色:; カーソル:手; } /*通常の表示ワードリスト項目*/ .optdelighted { テキスト装置:なし; 色: ; 背景色:; カーソル:; } - > </スタイル> <! - クライアントスクリプト - > <スクリプト言語= javascript> <! - //クライアントパブリックおよびテスト機能 // ********************************* //関数名:ltrim //関数:文字列の左側のスペースを削除します //入力:1。Strtemp:文字列は通常のものです。文字列タイプ //出力:通常の文字列。文字列タイプ // ********************************* 関数ltrim(strtemp) { var Icount、ilength; // -------------------------------------------------- //定数変数説明 // icount:カウンター。整数 // ilength:文字列の長さ。整数 // -------------------------------------------------- ilength = strtemp.length; for(icount = 0; icount< ilength; icount) if(strtemp.charat(icount)!=) returtemp.substring(icount、ilength); 戻る ; } // ********************************* //関数名:rtrim //関数:文字列の右側のスペースを削除します //入力:1。Strtemp:文字列は通常のものです。文字列タイプ //出力:通常の文字列。文字列タイプ // ********************************* 関数rtrim(strtemp) { var Icount、ilength; // -------------------------------------------------- //定数変数説明 // icount:カウンター。整数 // ilength:文字列の長さ。整数 // -------------------------------------------------- ilength = strtemp.length; for(icount = ilength -1; icount> = 0; icount-) if(strtemp.charat(icount)!=) returtemp.substring(0、icount 1); 戻る ; } // ********************************* //関数名:トリム //関数:文字列の両側のスペースを削除します //入力:1。Strtemp:文字列は通常のものです。文字列タイプ //出力:通常の文字列。文字列タイプ // ********************************* 関数トリム(strtemp) { Rtrim(ltrim(strtemp)); } // 2桁の番号を2桁の文字列に変換します // ********************************* //関数名:get2bnumstr //関数:2ビット番号を2ビット番号文字列に変換します //入力:1。inver:変換される数。整数 //出力:変換された数値文字列。整数 // ********************************* 関数get2bnumstr(inumber) { var str2bnum; // -------------------------------------------------- //定数変数説明 // str2bnum:数値文字列。文字列タイプ // -------------------------------------------------- if(parseint(inumber)<10) str2bnum = 0 inumber; それ以外 str2bnum = inumber; str2bnumを返します。 } // ********************************* // FUNC機能名:AssignFunc //関数:要素のイベント処理機能を指定します //入力:1。ELE:指定するイベント処理機能の要素。オブジェクトタイプ // 2。FUNC:イベント処理機能。機能的 //3。イベント:イベントタイプ。文字列タイプ //出力:なし // ********************************* 関数assignfunc(ele、func、event) { var iCount、iElecount; var strevent; // -------------------------------------------------- //定数変数説明 // icount:カウンター。整数 // iElecount:同じ名前の要素のコレクションの要素の数。整数 // strevent:イベントタイプ。文字列タイプ // -------------------------------------------------- if(event == null) strevent = onclick; それ以外 strevent = event; iElecount = ele.length; if(iElecount == undefined) eval(ele。strevent= func); それ以外 for(icount = 0; icount eval(ele [icount]。strevent= func); } // ********************************* //関数名:geteleindex //関数:イベントが同じ名前のコレクションで発生した要素のインデックスを取得します //入力:1。ELESRC:イベントが発生した要素。オブジェクトタイプ //出力:イベントが同じ名前のコレクションで発生した要素のインデックス // ********************************* 関数geteleindex(elesrc) { var colsrc; var iCount、iElecount; // -------------------------------------------------- //定数変数説明 // colsrc:同じ名前の要素のコレクション。オブジェクトタイプ配列 // icount:カウンター。整数 // iElecount:同じ名前の要素のコレクションの要素の数。整数 // -------------------------------------------------- colsrc = eval(elesrc.id); iElecount = colsrc.length; for(icount = 0; icount { if(colsrc [icount] == elesrc) Icountを返します。 } return -1; } //定数変数の値を表示します(デバッグ用) //!削除する準備をします 関数ショー(strdef1、strdef2、strdef3、strdef4) { var Icount、idefcnt; var Strshow、strtemp; IDEFCNT = 4; strshow = [定数変数値]; for(icount = 1; icount< = idefcnt; icount) { strtemp = eval(strdef icount); if(strtemp!= undefined && strtemp!= null) strshow = /n strtemp:eval(strtemp); } アラート(strshow); } // ********************************* //関数名:ShowArray //関数:1次元配列の要素を表示(デバッグ用) //入力:1。配列:表示される1次元配列。配列 //出力:なし // ********************************* 関数ショーアレイ(配列) { var iCount、iElecount; var Strshow; // -------------------------------------------------- //定数変数説明 // icount:カウンター。整数 // iElecount:配列要素の数。整数 // strshow:配列要素値で構成される文字列。文字列タイプ // -------------------------------------------------- iElecount = array.length; strshow =配列長:iElecount; strshow = /n ---------------------------------- /n; for(icount = 0; icount { if(typeof(array [icount])== object) strshow = array [icount] .id; それ以外 strshow = array [icount]; } アラート(strshow); } // ********************************* //関数名:show2darray //関数:2次元配列の要素を表示(デバッグ用) //入力:1。配列:表示される2次元配列。配列 //出力:なし // ********************************* 関数show2darray(配列) { var ix、iy、ilen1、ilen2; var Strshow; // -------------------------------------------------- //定数変数説明 // ix:カウンター。整数 // IY:カウンター。整数 // ILEN1:1次元配列の数。整数 // ILEN2:2次元配列の数。整数 // strshow:配列要素値で構成される文字列。文字列タイプ // -------------------------------------------------- ilen1 = array.length; strshow = array 1d length:ilen1; strshow = /n -----------------------------; for(ix = 0; ix<ILen1; ix) { strshow = /n; ilen2 = array [ix] .length; for(iy = 0; iy<iLen2; iy) strshow = array [ix] [iy]; } アラート(strshow); } //-> </スクリプト> <スクリプト言語= javascript> <! - //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // window_onload // // getWord //リセット //保存 //負荷 // // showlist // hidelist // FixList // Valuelist // // showhelp // Hidehelp // fixhelp // // resetall // saveall // loadall //組み立てる // // lightbtn // DelightBtn // Lightopt // gelateopt // // MEMSOPT // removeopt // --------------------------------------------------------------------------------------------------------------- var m_ipartcnt; var m_astrsenpart、m_astrwords; var m_strprompt; var m_ilistfixed、m_ihelpfixed; // -------------------------------------------------- //定数変数説明 // M_IPARTCNT:語彙カテゴリの数。整数 // M_ASTRSENPART:語彙分類の名前。文字配列 // M_ASTRODES:さまざまな語彙を記録します。二次元文字アレイ // M_STRPROMPT:ファイル操作が完了した後のプロンプトメッセージ。文字列タイプ // m_ilistfixed:固定された単語リストを表す番号。整数 // -1は、単語リストが修正されていないことを意味します // m_ihelpfixed:ヘルプリストの固定状態を表す数字。整数 // -1は、ヘルプリストが修正されていないことを意味します // -------------------------------------------------- window.onload = window_onload; // --------------------------------------------------------------------------------------------------------------- //ページを初期化します functionWindow_onload() { var Icount、ielecnt; var Colbutton; var Strhelp; // -------------------------------------------------- //定数変数説明 // icount:カウンター。整数 // IELECNT:コレクション内の要素の数。整数 // colbutton:ボタン要素のコレクション。オブジェクトタイプ配列 // strhelp:ファイルコンテンツをヘルプします。文字列タイプ // -------------------------------------------------- m_ipartcnt = <%= m_ipartcnt%>; M_STRPROMPT = <%= M_STRPROMPT%>; m_ilistfixed = -1; m_ihelpfixed = -1; M_ASTRSENPART = new Array(); m_astrwords = new Array(); // alert(m_ipartcnt:m_ipartcnt /nm_strprompt:m_strprompt); //語彙分類とロードされたさまざまな語彙の名前を取得します m_icount = 0から(m_ipartcnt -1)%の場合 //あらゆる種類の語彙をロードしてください <%if isempty(m_astrwords(m_icount))= true then%> m_astrwords [<%= m_icount%>] = new Array(); <%else%> m_astrwords [<%= m_icount%>] = <%= join(m_astrwords(m_icount)、、)%>。split(、); <%end if> //語彙分類の名前を取得します M_ASTRSENPART [<%= M_ICOUNT%>] = <%= M_ASTRSENPART(M_ICOUNT)%>; <%次の%> // show2darray(m_astrwords); // showArray(m_astrsenpart); //ページにあらゆる種類のロードされた語彙を書きます for(icount = 0; icount<m_ipartcnt; icount) Valuelist(M_ASTROWSS [ICOUNT]、ICOUNT); //ヘルプファイルをロードします // strhelp = tblhelp.outerhtml; // strhelp = divhelp1.innerhtml; //tblhelp.outerhtml =; //divhelp.innerhtml = strhelp; //tblhelp.style.display =; //divhelp.style.display = none; //divhelp.style.left = divhelp1.style.left; //アラート(左:divhelp.style.left /nleft:divhelp1.style.left); // alert(pixelleft:divhelp.style.pixelleft /npixelleft:divhelp1.style.pixelleft); // alert(posleft:divhelp.style.posleft /nposleft:divhelp1.style.posleft); // alert(offsetLeft:divhelp.offsetLeft /noffsetLeft:divhelp1.offsetLeft); // alert(clientLeft:divhelp.clientleft /nclientleft:divhelp1.clientleft); //ページ要素のイベント処理関数を指定します assightfunc(txtword、getword、onkeypress); assightfunc(btngetword、getWord); assightfunc(btnreset、reset); assightfunc(btnsave、save); assightfunc(btnload、load); assightfunc(lblwordlist、showlist、onmouseover); assightfunc(lblwordlist、hidelist、onmouseout); assightfunc(lblwordlist、fixlist); assightfunc(lblhelp、showhelp、onmouseover); assightfunc(lblhelp、hidehelp、onmouseout); assightfunc(lblhelp、fixhelp); assightfunc(btnresetall、resetall); assightfunc(btnsaveall、saveall); assightfunc(btnloadall、loadall); assightfunc(btnasb、assemble); colbutton = document.all.tags(button); IELECNT = colbutton.length; // showarray(colbutton); // alert(ielecnt:ielecnt); for(icount = 0; icount { assightfunc(colbutton [icount]、lightbtn、onmouseover); assightfunc(colbutton [iCount]、Delightbtn、onMouseout); } //ページの初期ステータスを設定します if(m_strprompt!=) アラート(M_STRPROMPT); txtword [0] .focus(); } // --------------------------------------------------------------------------------------------------------------- //ユーザーが入力した単語を取得します function getWord() { // ENTERを押したときのみ、またはWord入力ボックスに入力します // [保存]ボタンを押したときは続けます if(window.event.type!= keypress && windole.event.type!= click) 戻る; それ以外 if(window.event.type == keypress && window.event.keycode!= 13)return; var elesrc; var iindex、inxtwrdidx; var strword; // -------------------------------------------------- //定数変数説明 // ELESRC:イベントが発生した要素 // iindex:語彙分類を表す番号。整数 // inxtwrdidx:単語配列の新しい単語のインデックス。整数 // strword:ユーザーが入力した単語。文字列タイプ // -------------------------------------------------- ELESRC = WINDOW.EVENT.SRCELEMENT; iindex = geteleindex(elesrc); //インデックスを取得します strword = trim(txtword [iindex] .value); //ユーザーが入力した単語を取得します //入力された単語が合法かどうかを検出します //それが違法な言葉である場合、終了します if(strword ==) { //入力された単語が空またはスペース文字列の場合 アラート(単語が空になることも、スペース文字列にもなりません); txtword [iindex] .select(); 戻る; } if(strword.indexof(、)!= -1 || strword.indexof()!= -1) { //入力された単語にコンマまたはスペースが含まれている場合 アラート(単語はコンマやスペースを含めることはできません); txtword [iindex] .select(); 戻る; } //語彙配列に単語を保存します inxtwrdidx = m_astrwords [iindex] .length; m_astrwords [iindex] [inxtwrdidx] = strword; // showArray(m_astrwords [iindex]); //ページに単語を書きます Valuelist(M_ASTROWSS [IINDEX]、iIndex); txtword [iindex] .value =; txtword [iindex] .focus(); } // --------------------------------------------------------------------------------------------------------------- //メモリから現在のカテゴリのすべての単語を削除します function reset() { var elesrc; var iindex、icount; var strprompt; // -------------------------------------------------- //定数変数説明 // ELESRC:イベントが発生した要素 // iindex:語彙分類を表す番号。整数 // icount:カウンター。整数 // strprompt:操作プロンプト。文字列タイプ // -------------------------------------------------- ELESRC = WINDOW.EVENT.SRCELEMENT; iindex = geteleindex(elesrc); strprompt = [m_astrsenpart [iindex]]部分のすべての単語をメモリからクリアしたいですか? ; if(window.confirm(strprompt)== false)return; m_astrwords [iindex] = new array(); Valuelist(M_ASTROWSS [IINDEX]、iIndex); // showArray(m_astrwords [iindex]); strprompt = cleared; アラート(strprompt); txtword [iindex] .select(); } // --------------------------------------------------------------------------------------------------------------- //選択したカテゴリの現在の語彙をファイルに保存します function save() { var elesrc; var iindex、icount; // -------------------------------------------------- //定数変数説明 // ELESRC:イベントが発生した要素 // iindex:語彙分類を表す番号。整数 // icount:カウンター。整数 // -------------------------------------------------- ELESRC = WINDOW.EVENT.SRCELEMENT; iindex = geteleindex(elesrc); if(m_astrwords [iindex] .length == 0) { //選択したカテゴリの現在の単語数がゼロの場合 var strprompt; strprompt = [m_astrsenpart [iindex]]セクションにはオプションの単語がありませんが、保存したいですか? ; strprompt = /n(これにより、空の新しいファイルが生成されます); if(window.confirm(strprompt)== false)return; } //現在のメモリにすべての単語を保存します for(icount = 0; icount<m_ipartcnt; icount) eval(frmwords.txtwords icount).value = m_astrwords [icount] .jein(、); frmwords.txtsenpart.value = iindex; frmwords.txtopway.value = save; frmwords.submit(); } // --------------------------------------------------------------------------------------------------------------- //ファイルから選択したカテゴリの単語レコードを読み取ります function load() { var elesrc; var iindex、icount; // -------------------------------------------------- //定数変数説明 // ELESRC:イベントが発生した要素 // iindex:語彙分類を表す番号。整数 // icount:カウンター。整数 // -------------------------------------------------- ELESRC = WINDOW.EVENT.SRCELEMENT; iindex = geteleindex(elesrc); //現在のメモリにすべての単語を保存します for(icount = 0; icount<m_ipartcnt; icount) eval(frmwords.txtwords icount).value = m_astrwords [icount] .jein(、) frmwords.txtsenpart.value = iindex; frmwords.txtopway.value = load; frmwords.submit(); } // --------------------------------------------------------------------------------------------------------------- //語彙リストを表示します functionshowlist(iindex) { //パラメーターiindexが与えられていない場合 // iindexを取得します if(iindex == undefined) { //単語リストが既に固定されている場合、関数を終了します if(m_ilistfixed!= -1)return; var elesrc; var iindex; // -------------------------------------------------- //定数変数説明 // ELESRC:イベントが発生した要素 // iindex:語彙分類を表す番号。整数 // -------------------------------------------------- ELESRC = WINDOW.EVENT.SRCELEMENT; iindex = geteleindex(elesrc); } // alert(iindex:iindex); //語彙リストを表示します //lblWordList [iindex] .innertext = [lblWordList [iindex] .innertext]; //lblWordList [iindex] .innertext = lblwordList [iindex] .innertext>; lblWordList [iindex] .classname = lblmover; DivWordList [iindex] .className = listShown; } // --------------------------------------------------------------------------------------------------------------- //語彙リストを非表示にします function hidelist(iindex) { //パラメーターiindexが与えられていない場合 // iindexを取得します if(iindex == undefined) { //単語リストが既に固定されている場合、関数を終了します if(m_ilistfixed!= -1)return; var elesrc; var iindex; // -------------------------------------------------- //定数変数説明 // ELESRC:イベントが発生した要素 // iindex:語彙分類を表す番号。整数 // -------------------------------------------------- ELESRC = WINDOW.EVENT.SRCELEMENT; iindex = geteleindex(elesrc); } // alert(iindex:iindex); //語彙リストを非表示にします //lblWordList [iindex] .innertext = lblwordList [iindex] .innertext.slice(0、-1); lblwordList [iindex] .classname = lblmout; DivWordList [iindex] .classname = listhidden; } // --------------------------------------------------------------------------------------------------------------- // Vocabularyリストを修正しました functionfixList() { var elesrc; var iindex; // -------------------------------------------------- //定数変数説明 // ELESRC:イベントが発生した要素 // iindex:語彙分類を表す番号。整数 // -------------------------------------------------- ELESRC = WINDOW.EVENT.SRCELEMENT; iindex = geteleindex(elesrc); switch(m_ilistfixed) { ケース-1: //まだ単語リストがない場合 //現在のリストを修正します m_ilistfixed = iindex; lblWordList [iindex] .className = lblclicked; DivWordList [iindex] .className = listfixed; 壊す; case iindex: //固定された単語リストが現在のリストの場合 //現在のリストを解決します m_ilistfixed = -1; lblWordList [iindex] .classname = lblmover; DivWordList [iindex] .className = listShown; 壊す; デフォルト: //固定単語リストが現在のリストではない場合 //固定修正のリスト hidelist(m_ilistfixed); m_ilistfixed = -1; lblWordList [iindex] .classname = lblmover; showlist(iindex); 壊す; } // alert(m_ilistfixed:m_ilistfixed /niindex:iindex); } // --------------------------------------------------------------------------------------------------------------- //特定のタイプの語彙でロードされた単語を書きます 機能バルエリスト(Awords、Isenpart) { var icount、iwrdcnt; var strlistppt; // -------------------------------------------------- //定数変数説明 // icount:カウンター。整数 // iwrdcnt:特定のタイプの語彙の単語の数。整数 // strlistppt:ワードリストのプロンプト。文字列タイプ // -------------------------------------------------- //データ準備 iwrdcnt = awords.length; lblWordCount [ISENPART] .innertext = iwrdcnt; strlistppt = <div><スパンstyle = 'color:red;フォントスタイル:イタリック; font-size:10.5pt; '>; strlistppt =単語をダブルクリックして削除する</span> </div>; //リストに単語を書きます if(iwrdcnt!= 0) { DivWordList [ISENPART] .INNERHTML = STRLISTPPT; for(icount = 0; icount<iwrdcnt; icount) DivWordList [isenpart] .innerhtml = makeopt(awords [icount]、icount); } それ以外 DivWordList [ISENPART] .INNERHTML = STRLISTPPT; } // --------------------------------------------------------------------------------------------------------------- //ヘルプリストを表示します functionshoshelp() { //ヘルプリストが修正されている場合は、機能を終了します if(m_ihelpfixed == 0)return; //ヘルプを表示します lblhelp.classname = lblmover; Divhelp.classname = helpshown; } // --------------------------------------------------------------------------------------------------------------- //ヘルプリストを非表示にします 関数hidehelp() { //ヘルプリストが修正されている場合は、機能を終了します if(m_ihelpfixed == 0)return; //ヘルプを非表示にします lblhelp.classname = lblmout; Divhelp.classname = helphidden; } // --------------------------------------------------------------------------------------------------------------- //ヘルプリストを修正しました 関数fixhelp() { if(m_ihelpfixed == -1) { //ヘルプリストが修正されていない場合 //それを修正します m_ihelpfixed = 0; lblhelp.classname = lblclicked; divhelp.classname = helpfixed; } それ以外 { //ヘルプリストが修正されている場合 //それを解決します m_ihelpfixed = -1; lblhelp.classname = lblmover; Divhelp.classname = helpshown; } } // --------------------------------------------------------------------------------------------------------------- //ページを初期状態にリセットします function resetall() { var Icount; // -------------------------------------------------- //定数変数説明 // icount:カウンター。整数 // -------------------------------------------------- for(icount = 0; icount<m_ipartcnt; icount) { txtword [icount] .value =; m_astrwords [icount] = new Array(); //単語配列を空にします Valuelist(M_ASTROWSS [ICOUNT]、ICOUNT); } txtsentence.value =; txtword [0] .focus(); } // --------------------------------------------------------------------------------------------------------------- //すべてのカテゴリの単語をファイルに保存します 関数saveall() { var icount、iemptycnt; var strprompt; // -------------------------------------------------- //定数変数説明 // icount:カウンター。整数 // iEmptycnt:単語が0のカテゴリの数。整数 // strprompt:操作プロンプト。文字列タイプ // -------------------------------------------------- iEmptycnt = 0; for(icount = 0; icount<m_ipartcnt; icount) { //現在のメモリにすべての単語を保存します eval(frmwords.txtwords icount).value = m_astrwords [icount] .jein(、); if(m_astrwords [icount] .length == 0) iemptycnt; } // alert(iemptycnt:iemptycnt); if(iemptycnt>0) { switch(iemptycnt) { ケースM_IPARTCNT: strprompt =すべてのカテゴリの語彙の数は0であり、操作によりm_ipartcnt空のファイルが生成されます。 strprompt = /nあなたはこれをやりたいと思っていますか? ; 壊す; デフォルト: strprompt = where、; for(icount = 0; icount<m_ipartcnt; icount) if(m_astrwords [icount] .length == 0) strprompt = [m_astrsenpart [icount]]、; strprompt = strprompt.slice(0、-1); strprompt =いくつかの単語の数は0です。 strprompt = /n操作はiEmptycnt空のファイルを生成します。 strprompt =、これをやりたいですか? ; } if(window.confirm(strprompt)== false)return; } frmwords.txtopway.value = saveall; frmwords.submit(); } // --------------------------------------------------------------------------------------------------------------- //ファイルからすべてのカテゴリの単語をロードします function loadall() { var Icount; // -------------------------------------------------- //定数変数説明 // icount:カウンター。整数 // -------------------------------------------------- //現在のメモリにすべての単語を保存します for(icount = 0; icount<m_ipartcnt; icount) eval(frmwords.txtwords icount).value = m_astrwords [icount] .jein(、) frmwords.txtopway.value = loadall; frmwords.submit(); } // --------------------------------------------------------------------------------------------------------------- //ボキャブラリーの一致をして、文を取得してください 関数assemble() { var icount、iwrdcnt、irndindex; var strsentence; // -------------------------------------------------- //定数変数説明 // icount:カウンター。整数 // iwrdcnt:特定のタイプの語彙の単語の数。整数 // irndindex:ランダムに生成された単語インデックス。整数 // strsentence:語彙の各カテゴリのランダムな単語で構成される文。文字列タイプ // -------------------------------------------------- strsentence =; for(icount = 0; icount<m_ipartcnt; icount) { //カテゴリの語彙の現在の数が0の場合 //プロンプトを与え、コロケーションを中止します iwrdcnt = m_astrwords [icount] .length; if(iwrdcnt == 0) { var strprompt; // -------------------------------------------------- //定数変数説明 // strprompt:操作プロンプト。文字列タイプ // -------------------------------------------------- strprompt = [m_astrsenpart [icount]]パートにはオプションの単語がありません。 strprompt = /nplease少なくとも1つの単語を入力します。 アラート(strprompt); txtword [icount] .select(); 戻る; } //随机抽取当前类别词汇中的一个单词 //加入到句子中 iRndIndex = Math.floor(Math.random()*iWrdCnt); strSentence = m_astrWords[iCount][iRndIndex]; //alert(iWrdCnt: iWrdCnt /niRndIndex: iRndIndex); } strSentence = . ; txtSentence.value = strSentence; } //使鼠标移到之处的按钮 //产生点亮的效果 function lightBtn() { var eleSrc; //------------------------------------------ //常变量说明 //eleSrc :发生事件的元素 //------------------------------------------ eleSrc = window.event.srcElement; while (eleSrc.tagName.toUpperCase() != BUTTON) eleSrc = eleSrc.parentElement; eleSrc.className = btnLighted; } //使鼠标离开的按钮 //还原为初始状态 function delightBtn() { var eleSrc; //------------------------------------------ //常变量说明 //eleSrc :发生事件的元素 //------------------------------------------ eleSrc = window.event.srcElement; while (eleSrc.tagName.toUpperCase() != BUTTON) eleSrc = eleSrc.parentElement; eleSrc.className = btnDelighted; } //在列表中,使鼠标移到之处的单词 //产生点亮的效果 function lightOpt(ele) { var eleSrc; //------------------------------------------ //常变量说明 //eleSrc :发生事件的元素 //------------------------------------------ eleSrc = ele; eleSrc.className = optLighted; } //在列表中,使鼠标离开的单词 //还原为初始状态 function delightOpt(ele) { var eleSrc; //------------------------------------------ //常变量说明 //eleSrc :发生事件的元素 //------------------------------------------ eleSrc = ele; eleSrc.className = optDelighted; } //得到定义过的将加入列表的单词 function makeOpt(strWord, iWrdIdx) { var strOptHead, strOptFoot; var strOptWord; //------------------------------------------ //常变量说明 //strOptHead :重定义单词头。字符串型 //strOptFoot :重定义单词尾。字符串型 //strOptWord :重定义单词。字符串型 //------------------------------------------ strOptHead = <div class='optDelighted' onmouseover='lightOpt(this);' onmouseout='delightOpt(this);' ondblclick='removeOpt(this);' wrdIdx=' iWrdIdx '>; strOptFoot = </div>; strOptWord = strOptHead strWord strOptFoot; //alert(strOptWord); return strOptWord; } //删除列表中的单词 function removeOpt(ele) { var eleSrc; var iIndex, iWrdIdx; var astrWords, astrHead, astrFoot; //------------------------------------------ //常变量说明 //eleSrc :发生事件的元素 //iIndex: Number representing vocabulary classification.整数 //iWrdIdx: The index of words in word array.整数 //astrWords :某类词汇单词数组。字符串型数组 //astrHead :某类词汇单词数组头部分。字符串型数组 //astrFoot :某类词汇单词数组尾部分。字符串型数组 //------------------------------------------ eleSrc = ele; iIndex = getEleIndex(eleSrc.parentElement); iWrdIdx = parseInt(eleSrc.wrdIdx); //将单词从词汇数组中删去 //showArray(m_astrWords[iIndex]); astrWords = m_astrWords[iIndex].concat(); astrHead = astrWords.slice(0, iWrdIdx); astrFoot = astrWords.slice(iWrdIdx 1); m_astrWords[iIndex] = astrHead.concat(astrFoot); //showArray(astrHead); //showArray(astrFoot); //showArray(m_astrWords[iIndex]); //将剩余的单词重新写入到页面中 valueList(m_astrWords[iIndex], iIndex); txtWord[iIndex].select(); } //--> </script> </head> <body> <!--标题--> <div align=CENTER> <span style=font-size: 20pt; font-weight: BOLD>词语搭配游戏</span> <span class=fontEng2>v1.0</span> </div> <hr style=visibility: HIDDEN> <!--主表格1--> <table border=0 align=CENTER width=80%> <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup> <colgroup align=CENTER></colgroup> <colgroup></colgroup> <%For m_iCount = 0 To (m_iPartCnt - 1)%> <tr> <td><%= m_astrSenPart(m_iCount)%></td> <td width=20%><input type=text id=txtWord style=width: 100%></td> <td><button id=btnGetWord style=width: 75px title=将单词保存到内存中>保存</button></td> <td><button id=btnReset style=width: 75px title=从内存中删去当前类别所有的单词>重置</button></td> <td><button id=btnSave style=width: 75px title=将单词保存到文件中>存入</button></td> <td><button id=btnLoad style=width: 75px title=从文件中载入单词>载入</button></td> <td width=15%><label id=lblWordList title=单击固定我>单词列表</label></td> <td> <div id=divWordList class=listHidden></div> 个数:<label id=lblWordCount class=fontEng1><%= 0%></label> </td> </tr> <%Next%> </table> <hr style=visibility: HIDDEN> <hr style=color: BLUE> <!--主表格2--> <table border=0 align=CENTER width=80%> <colgroup width=16%></colgroup> <colgroup width=16%></colgroup> <colgroup width=16%></colgroup> <colgroup></colgroup> <tr> <td><button id=btnResetAll accesskey=r title=从内存中删去所有类别的单词class=btnDelighted>全部重置<u>R</u></button></td> <td><button id=btnSaveAll accesskey=s title=将所有类别的单词保存到文件中class=btnDelighted>全部存入<u>S</u></button></td> <td><button id=btnLoadAll accesskey=l title=从文件中载入所有类别的单词class=btnDelighted>全部载入<u>L</u></button></td> <td> <span style=font-size: 9pt; color: RED;>请单击</span> <label id=lblHelp title=单击固定我>游戏说明</label> <!--帮助说明表格--> <div id=divHelp class=helpHidden> <table id=tblHelp border=0 align=CENTER width=300px style=font-size: 9pt;> <colgroup width=75px></colgroup> <colgroup></colgroup> <tr><td colspan=2> <a href=#1 style=color: BLUE;>游戏步骤</a> <a href=#2 style=color: BLUE;>操作说明</a> <a href=#3 style=color: BLUE;>游戏起源</a> <a href=#4 style=color: BLUE;>制作原因</a> <a href=#5 style=color: BLUE;>游戏功效</a> <a name=0 style=display: NONE;>TOP</a> </td></tr> <!--游戏步骤--> <tr><td colspan=2></td></tr> <tr><td colspan=2> [<a name=1 style=color: BLUE;>游戏步骤</a>] <a href=#0 class=link>TOP</a> </td></tr> <tr><td colspan=2> <span class=fontEng1><1></span>在每个部分的<span class=fontEmp>输入框</span>中输入单词, 按<span class=fontEmp>回车</span>或<span class=fontEmp>保存</span>按钮存入内存中; 或按<span class=fontEmp>载入</span>按钮调出以前保存的某类别单词纪录; 或按<span class=fontEmp>全部载入</span>按钮调出以前保存的所有类别单词纪录<br> <span class=fontEng1><2></span>按<span class=fontEmp>开始搭配</span>按钮,系统将从各类单词中随机抽取一个,组成一个句子 </td></tr> <!--操作说明--> <tr><td colspan=2></td></tr> <tr><td colspan=2> [<a name=2 style=color: BLUE;>操作说明</a>] <a href=#0 class=link>TOP</a> </td></tr> <tr> <td>保存</td> <td>得到用户输入的单词</td> </tr> <tr> <td>重置</td> <td>将当前类别所有的单词从内存中删去</td> </tr> <tr> <td>存入</td> <td>将所选类别的当前词汇保存进文件中</td> </tr> <tr> <td>载入</td> <td>从文件中读取所选类别的单词纪录</td> </tr> <tr> <td>全部重置</td> <td>重置页面至初始状态</td> </tr> <tr> <td>全部保存</td> <td>把所有类别的单词都存入文件</td> </tr> <tr> <td>全部载入</td> <td>从文件中载入所有类别的单词</td> </tr> <tr> <td>开始搭配</td> <td>进行词汇搭配,得到一个句子</td> </tr> <tr><td></td></tr> <tr><td colspan=2> <span class=fontEng1><1></span> <span class=fontEmp>将鼠标移至单词列表处</span>,会弹出该类词汇的单词列表; <span class=fontEmp>将鼠标移开</span>,列表会自动隐藏; <span class=fontEmp>点击单词列表</span>,会固定单词列表; <span class=fontEmp>再次点击</span>,会取消固定<br> <span class=fontEng1><2></span> 在<span class=fontEmp>固定住一个单词列表</span>后, <span class=fontEmp>双击</span>该列表中的某个单词,可以将该单词从内存中删去<br> <span class=fontEng1><3></span> 输完一个单词后,<span class=fontEmp>直接按回车</span>就可以保存了,这样比按保存保存单词更方便 </td></tr> <!--游戏起源--> <tr><td colspan=2></td></tr> <tr><td colspan=2> [<a name=3 style=color: BLUE;>游戏起源</a>] <a href=#0 class=link>TOP</a> </td></tr> <tr><td colspan=2> 这个游戏想法来自于小时候玩的纸团游戏。那时和姐姐在家里闲得无聊,就玩这个,哈哈。 玩法很简单,做一些纸片,分成四堆,分别写上<span class=fontEmp>亲朋好友的名字</span>、<span class=fontEmp>形容程度的词语</span>、<span class=fontEmp>关于地点的词语</span>和<span class=fontEmp>所做的事情</span>。 然后,将纸片捏成纸团,<span class=fontEng1>OK, Let's Start!</span> 现在从每堆中抽出一个纸团,就有四个词语,将它们组成一句话,因为是随便抽的,有时能组成很搞笑的句子。 如:陈楠兴奋地在大街上跳夏威夷草裙舞;万民悠闲地在公园里洗澡。^_ </td></tr> <!--制作原因--> <tr><td colspan=2></td></tr> <tr><td colspan=2> [<a name=4 style=color: BLUE;>制作原因</a>] <a href=#0 class=link>TOP</a> </td></tr> <tr><td colspan=2> 主要是无聊,想做个游戏娱乐一下自己,当然也希望大家能从中得到笑声。 其次也想锻炼一下自己的技术,以前用<span class=fontEng1>VB</span>做过一个,不是很好,这次用的是<span class=fontEng1>ASP</span>,不知有没有进步,呵呵 这个版本我大概地测试了一下,没发现大的<span class=fontEng1>bug</span>。如果您在游戏中发现了问题或有什么建议,请一定告诉我,在此先谢谢了! 我的信箱是<a href=mailto: [email protected] class=link>[email protected]</a>。不好你就说吗!不可能你说好我又说不好,你不说好我又说好的,^_ </td></tr> <!--游戏功效--> <tr><td colspan=2></td></tr> <tr><td colspan=2> [<a name=5 style=color: BLUE;>游戏功效</a>] <a href=#0 class=link>TOP</a> </td></tr> <tr><td colspan=2> 因为是搞笑游戏,所以能使你心情愉快、青春焕发,间接增加找对象的成功率; 因为不用做纸团了,减少了浪费和污染,从而美化了世界环境; I believe there are many benefits, please help me find it.ハハ。 </td></tr> </table> </div> </td> </tr> <tr> <td><button id=btnAsb accesskey=a title=从每个类别词汇中随机抽取一个单词,组成一个句子class=btnDelighted>开始搭配<u>A</u></button></td> <td colspan=3><input type=text id=txtSentence style=width: 100%></td> </tr> </table> <hr style=color: BLUE> <!--提交表单--> <form id=frmWords method=POST action= style=display: NONE;> <%For m_iCount = 0 To (m_iPartCnt - 1)%> <input type=text name=txtWords<%= m_iCount%>> <%Next%> <input type=text name=txtSenPart> <input type=text name=txtOpWay> </form> <!--版权--> <div align=CENTER> <div> © <span class=fontEng2>2001 China Sentin Sci. & Tech. Co., Ltd.</span> <span class=fontEng2>All Rights Reserved.</span> </div> <div> <span class=fontEng2>Authored by</span> <a href=mailto: [email protected] class=link>Recon</a></span> <a href=http://recon.top263.net/ class=link>http://recon.top263.net/</a> </div> </div> </body> </html> <% '以下是服务器端脚本 '用到的函数和过程 '************************ '函数名:SaveFile '功能:将某类词汇保存到文件中 'Input: 1. iSenPart: a number representing the vocabulary classification.整数 ' 可能的值有: ' 0:主语 ' 1:程度状语 ' 2:地点状语 ' 3:谓语 'Output: The status value after the file operation.整数 ' 可能的值有: ' 0:操作成功 ' 1:操作失败 '************************ Function SaveFile(iSenPart) Dim fsoMain, tsfWords Dim iCount, iWrdCnt Dim iOpStatus '------------------------------------------ '常变量说明 'fsoMain :FSO对象 'tsfWords :TEXTSTREAM对象 'iCount : Counter.整数 'iWrdCnt: The number of words of a certain type of vocabulary.整数 'iOpStatus: The status after the file operation is completed.整数 '------------------------------------------ Set fsoMain = Server.CreateObject(SCRIPTING.FILESYSTEMOBJECT) Set tsfWords= fsoMain.CreateTextFile(m_strFilePath & m_astrFileName(iSenPart), True) tsfWords.WriteLine([ & m_astrSenPart(iSenPart) & 部分]) '如果该类别至少有一个单词 If IsEmpty(m_astrWords(iSenPart)) = False Then iWrdCnt = UBound(m_astrWords(iSenPart)) 1 For iCount = 0 To (iWrdCnt - 1) tsfWords.WriteLine(m_astrWords(iSenPart)(iCount)) 次 ifを終了します tsfWords.Close iOpStatus = 0 SaveFile = iOpStatus エンド関数 '************************ '函数名:LoadFile '功能:从文件中载入某类词汇 'Input: 1. iSenPart: a number representing the vocabulary classification.整数 ' 可能的值有: ' 0:主语 ' 1:程度状语 ' 2:地点状语 ' 3:谓语 'Output: The status value after the file operation.整数 ' 可能的值有: ' 0:操作成功 ' 1:操作失败 '************************ Function LoadFile(iSenPart) Dim fsoMain, tsfWords Dim strLoaded Dim iOpStatus '------------------------------------------ '常变量说明 'fsoMain :FSO对象 'tsfWords :TEXTSTREAM对象 'strLoaded :某类词汇所有单词构成的字符串。字符串型 'iOpStatus: The status after the file operation is completed.整数 '------------------------------------------ Set fsoMain = Server.CreateObject(SCRIPTING.FILESYSTEMOBJECT) If fsoMain.FileExists(m_strFilePath & m_astrFileName(iSenPart)) = True Then '如果存在纪录文件 strLoaded = Set tsfWords= fsoMain.OpenTextFile(m_strFilePath & m_astrFileName(iSenPart), 1) tsfWords.SkipLine Do While tsfWords.AtEndOfStream = False strLoaded = strLoaded & tsfWords.ReadLine & , ループ If strLoaded <> Then strLoaded = Left(strLoaded, Len(strLoaded) - 1) m_astrWords(iSenPart) = Split(strLoaded, ,) それ以外 m_astrWords(iSenPart) = Empty ifを終了します tsfWords.Close iOpStatus = 0 それ以外 '如果不存在纪录文件 iOpStatus = 1 ifを終了します LoadFile = iOpStatus エンド関数 %> <% '以下是服务器端脚本 '用于测试的函数和过程 Sub Show(strDef) Response.Write strDef & : & Eval(strDef) & <br> End Sub Sub ShowMethod() Response.Write Request Method: & Request.ServerVariables(REQUEST_METHOD) & <br> End Sub Sub ShowForm() iCount Dim strProp iCount = 0 Response.Write *********Form Information******<br> For Each strProp In Request.Form iCount = iCount 1 Response.Write iCount & . & strProp & : & Request.Form(strProp) & <br> 次 Response.Write *********Form End**************<br> End Sub %> |
分享:ASP 3.0高级编程(十二) 4.2.3 服务器端包含指令的例子本节提供了一些示例页面,可以用来对各种服务器端包含语句进行实验。打开示例网页的子目录Chapter04,显示SSI Directives and the ASP Server Object&rdqu