Time of Update: 2017-01-13
我們的執行個體是擷取checkbox值然後判斷使用者給的字串是否存在checkbox中,原理一樣的。<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"><html xmlns="http://www.111cn.net
Time of Update: 2017-01-13
如果字串中有空格或是其他分割符分割,可以用split方法先拆分,返回一個數組,再把這個數組裡的年月日作為參數傳到new date()裡產生日期類型; 如過沒有特殊分隔字元,可以用substr(x,y)方法來取子字串來產生日期,substr(x,y)裡,x表示取字串的開始位置,y表示子串的長度! 如果字串以"/"分割可以用date.parse(datestr)來轉換。看下執行個體以"-"分開var checkstartdate =
Time of Update: 2017-01-13
網頁特效 中英文網域名稱驗證函式*/function ischdomain(argstring){ var flag=false; var comps教程tr="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz-1234567890"; var length1=argstring.length; for(var chrindex=0;
Time of Update: 2017-01-13
有時我們利用架構來製作一個在iframe中開啟新的頁面,下面來看詳細代碼。<script type="text/網頁特效"> function redirect(src){ document.getelementbyid("page").src = src; } </script> <div> <ul> <li><a
Time of Update: 2017-01-13
方法一<div id="div1" onmouseo教程ver="document.getelementbyid('div2').style.display='block';">觸發顯示浮動層</div> <div id="div2" onmousemove='this.style.display="";'
Time of Update: 2017-01-13
--><script>function checkifchinese(string) { var re = /[^u4e00-u9fa5]/; if(re.test(string)) return false; return true; }function checkifenglish(string){ var letters =
Time of Update: 2017-01-13
在js中我們要判斷一個字串出現在另一字串中,利用indexof下面來看看它的文法stringobject.indexof(searchvalue,fromindex)參數strobj 必選項。string 對象或文字。 substring 必選項。要在 string 對象中尋找的子字串。 starindex 可選項。該整數值指出在 string 對象內開始尋找的索引。如果省略,則從字串的開始處尋找。 說明indexof 方法返回一個整數值,指出 string
Time of Update: 2017-01-13
lastindexof 方法:返回 string 對象中子字串最後出現的位置。stringobject.lastindexof(searchvalue,fromindex)參數strobj 必選項。string 對象或文字。 substring 必選項。要在 string 對象內尋找的子字串。 startindex 可選項。該整數值指出在 string 對象內進行尋找的開始索引位置。如果省略,則尋找從字串的末尾開始。 說明lastindexof 方法返回一個整數值,指出 string
Time of Update: 2017-01-13
1。 //使用變數的屬性 <script type="text/網頁特效"> var txt="hello world!" document.write(txt.length) </script>2。 //把字串中的所有字母都被轉化為大寫字母。 <script type="text/javascript"> var str="hello world!"
Time of Update: 2017-01-13
*以下以 ie 代替 internet explorer,以 mf/ff 代替 mozzila firefox *///window.event ie:有window.event對象 ff:沒有window.event對象。可以通過給函數的參數傳遞event對象。如onmousemove=domousemove(event) 解決方案:var event = event || window.event; example: 代碼如下:<script> function
Time of Update: 2017-01-13
*/function isip(data){ var regip=/^((1?d?d|(2([0-4]d|5[0-5]))).){3}(1?d?d|(2([0-4]d|5[0-5])))$/; return regip.test(data);}function ismobile(mno){ var regmobile=/^0?1(3|5|8)d{9}$/; return regmobile.test(mno);}function
Time of Update: 2017-01-13
function isidcardno(idvalue) { var len=0, re; len=idvalue.length; if (len == 15 && isnumberstring(idvalue,"1234
Time of Update: 2017-01-13
<span id="a1"><a href='/plus/view.php教程?aid=436' ><span>網站地圖</span></a></span><span id="a1"><a href='/plus/list.php?tid=42' ><span>老師專欄 </span></a></span><
Time of Update: 2017-01-13
基本文法: window.open(pageurl,name,parameters) 其中: pageurl 為子視窗路徑 name 為子視窗控制代碼 parameters 為視窗參數(各參數用逗號分隔) 下面看一個執行個體 window.open()支援環境:
Time of Update: 2017-01-13
刪除數組中資料array.prototype.del = function(n) { if (n<0) return this; return this.slice(0,n).concat(this.slice(n+1,this.length)); } // 數組洗牌 array.prototype.random = function() { var nr=[], me=this, t; while(me.length>0) { nr[nr.length] = me[t =
Time of Update: 2017-01-13
<script> //定義js的user對象 function user(name,age){ this.name=name, this.age=age, this.getname=function(){ return this.name; }, this.getage=function(){ return this.age; } } //執行個體化一個對象 var use=new user("aa",21); alert(use.name);
Time of Update: 2017-01-13
本款js是把目錄上傳哦,就是相當於批量上傳檔案了。 <!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">
Time of Update: 2017-01-13
/頁面代碼 (簡化)<asp教程:textbox id="tboperation2" runat="server" onclick="buttonclick($(this))" css教程class="ui-button-icons-only" text="按鈕"></asp:textbox> <div id="editdialog" title=
Time of Update: 2017-01-13
文法stringobject.indexof(searchvalue,fromindex)<script type="text/網頁特效"> var str="hello world!" //w小寫 document.write(str.indexof("h") + "<br />") //0 document.write(str.indexof("world") +
Time of Update: 2017-01-13
文法stringobject.match(searchvalue)stringobject.match(regexp)<script type="text/網頁特效"> var str="hello world!" document.write(str.match("world") + "<br />") //world