發表文章

目前顯示的是 4月, 2011的文章

【VB】文字檔-寫檔及讀檔-I

使用說明: FreeFile() - 傳回 FileOpen 函數下一個可用的檔案代號,傳回值是整數 FileOpen(檔案代號, 檔案名稱路徑, 檔案開啟模式) - 使用檔案開啟模式,開啟檔案代號的檔案 - 檔案開啟模式 - OpenMode.Input :從檔案中讀取字元,這是已經存在的檔案,程式需要使用Try/End Try錯誤處理避免開啟不存在的檔案 - OpenMode.Output :將字元寫入檔案,如果檔案不存在,就建立此檔案,如果檔案已有內容會清除內容 - OpenMode.Append :將字元寫入檔案結尾的最後,它不會清除檔案內容,只是加在最後,如果檔案不存在,就建立此檔案 FileClose(檔案代號) - 關閉檔案代號的檔案 Print(檔案代號, String) - 將參數 String 的字串寫入檔案代號的檔案 PrintLine(檔案代號, String) - 同 Print 函數,只是在最後加一個換行符號 LineInput(檔案代號) - 傳回開啟循序檔讀取的單行資料,但是不包含換行符號,傳回值是 String 字串變數 EOF(檔案代號) - 傳回參數檔案代號的檔案是否已經到達檔尾,傳回布林值 True 為是,False 為否 例:寫入資料到 Test.txt 檔案中 Dim FileNum As Integer Dim strTemp as String FileNum = FreeFile() FileOpen(FileNum, "C:\Test.txt", OpenMode.Output) strTemp = "輸入測試字串" PrintLine(FileNum, strTemp) FileClose(FileNum) 例:從 Test.txt 檔案中讀取資料 Dim FileNum As Integer Dim strTemp as String FileNum = FreeFile() FileOpen(FileNum, "C:\Test.txt", OpenMode.Input) Do Until EOF(FileNum)     strTemp &= LineInput(FileNum) & vbNewLine Loop FileClose...

【JQuery】checkbox 全選及全消

圖片
使用JQuery前,需要引用Jquery元件 HTML 頁面 <form id=" ManagerAddForm ">   <input type="checkbox" name="SubModuleID[]" value="1" class="chk" /> 選擇_1 <br/>   <input type="checkbox" name="SubModuleID[]" value="2" class="chk" /> 選擇_2 <br/>   <input type="checkbox" name="SubModuleID[]" value="3" class="chk" /> 選擇_3 <br/>   <input type="checkbox" name="SubModuleID[]" value="4" class="chk" /> 選擇_4 <br/>   <input type="checkbox" name="SubModuleID[]" value="5" class="chk" /> 選擇_5 <br/>   <br/>   <a href="javascript:;" id=" btn_selectall ">全選</a> | <a href="javascript:;" id=" btn_selectall_no ">全消</a> </form> Javascript 部份 <script language="javascript...

【VB】彈跳視窗應用相當於MsgBox

JavaScript  version  Sub OpenMsg(ByVal Msg2Show As String) 'Pop-up a message dialogue         Response.Write("<" + "Script language=""JavaScript"">" + Chr(13))         Response.Write("window.alert('" & Msg2Show & "'); " + Chr(13))         response.write("</" + "Script>")   End Sub VbScript  version Sub OpenMsg(Msg2Show as string) 'Pop-up a message dialogue response.write("<"+"Script language=""VBScript"">"+chr(13)) response.write("Msgbox """+Msg2Show+" "",, ""訊息"" "+chr(13)) response.write("</"+"Script>") end sub 若有使用到CSS套用版面的話,建議使用下列的寫法:  Sub OpenMsg(ByVal Msg2Show As String) 'Pop-up a message dialogue         Dim Msg As String = ""         Msg = "<Script language=""JavaScript"">" & vb...

【JavaScript】手機號碼驗證

<script type='text/javascript'>   function IsNumeric(sText)  {     //判斷是否為數值        var ValidChars = "0123456789";       參考本Blog: 判斷是否為數字--IsNumeric  }       function Left(str, n)  {     參考本Blog: 字串擷取--Left  } function ChkMobile() { if (document. form1 . p_mobile1 .value.length!=0 && document. form1 . p_mobile2 .value.length!=0)     {         var handy=document. form1 . p_mobile1 .value.length+document. form1 . p_mobile2 .value.length;              if ( IsNumeric (document. form1 . p_mobile1 .value)==false)             {                    alert('手機號碼只能為數字!');         ...

【ASP】過濾SQL及Javascript 關鍵字

<% Function csstr(thetext) ttext=thetext BlackList = Array("'", "';", "/*", "*/", "@@","--",_                              "char", "nchar", "varchar", "nvarchar",_                               "alter", "begin", "cast", "create", "cursor",_                              "declare", "delete", "drop", "end", "exec",_                              "execute", "fetch", "insert", "kill", "open",_        ...