Time of Update: 2017-01-13
tree.js代碼******************************** 樹形組織架構列表 v1.0 2011年1月6日 作者:flycrosscloud ********************************/ //初始化架構 var allimages = { hasnodeclose: "<img src='image/ftv2pnode.gif'/>", //包含子節點,閉合狀態(不是最後一個) hasnodeopen: "&
Time of Update: 2017-01-13
1.在父視窗中操作 選中iframe中的所有單選鈕$(window.frames["iframe1"].document).find("input[@type='radio']").attr("checked","true");2.在iframe中操作 選中父視窗中的所有單選鈕$(window.parent.document).find("input[@type='radio']").attr(&
Time of Update: 2017-01-13
網頁特效中建立自己的類和對象,我們應該是必須掌握的,我們都知道javascript中對象的屬性可以在對象建立後動態定義,比如下面的代碼: 代碼如下:<script type="text/javascript"> //定義 var ocar = new object(); ocar.color = "red"; ocar.doors = 4; ocar.showcolor = function() {
Time of Update: 2017-01-13
先我們來看看它的定義: 代碼如下:var arrayobj = new array() var arrayobj = new array([size]) var arrayobj = new array([element0[, element1[, [, elementn]]]]) 其中:arrayobj是賦值為 array 對象的變數名。 size由於數組的下標是從零開始,建立的元素的下標將從零到 size -1。 element0,...,elementn這將建立具有 n + 1
Time of Update: 2017-01-13
網頁特效 事件Binder 方法與相容ie ff解決辦法var t = document.getelementbyid("tab1"); t.onclick = function tst(){ alert(''); } 第二種方法 var tb = document.getelementbyid("tab1"); if(window.addeventlistener){ // mozilla, netscape, firefox
Time of Update: 2017-01-13
arr[j]==i 您這裡貌似 是指當數組元素 為number類型時的相等性判斷... 但是往往我們可能要對不同類型做 相等性判斷... 這個是實際應用時應該考慮的問題1!=new number(1)的情況 null==undefined 的情況0=="0" 的情況 等等所以 顯然 簡單的== 和===都是不合適的. 應該獨立實現一個 equals 方法 做相等性判斷... 要根據需求 設定規則 <script> array.prototype.del
Time of Update: 2017-01-13
offsetleft假設 obj 為某個 html 控制項。obj.offsettop 指 obj 距離上方或上層控制項的位置,整型,單位像素。obj.offsetleft 指 obj 距離左方或上層控制項的位置,整型,單位像素。obj.offsetwidth 指 obj 控制項自身的寬度,整型,單位像素。obj.offsetheight 指 obj
Time of Update: 2017-01-13
typeof可以擷取變數的類型 有如下6種傳回值: 1)number; 2)string; 3)boolean; 4)object
Time of Update: 2017-01-13
input高度固定,自動成長<br><input type="text" style="width:60;overflow-x:visible;overflow-y:visible;"><br><br>textarea 寬度固定,自動增高<br><textarea type="text" style="width:
Time of Update: 2017-01-13
利用網頁特效 str.replace(/-/g,"!")則可以全部替換掉匹配的字元(g為全域標誌)。<script type="text/javascript"> string.prototype.replaceall = function(reallydo, replacewith, ignorecase) { if (!regexp.prototype.isprototypeof(reallydo)) { return
Time of Update: 2017-01-13
我們用正常的replace替換中文是替換不了,下面我們利用new regexp來實現中文替換。<script> function replaceexp() { var stringname = "資料 "; var
Time of Update: 2017-01-13
不用迴圈純用正則實現從 url 中取參數的值。取代迴圈的核心技術是字串的 replace() 方法可以用函數作第二參數,按使用者定義的方式去替換。 //若有此參數名但無值,則返回Null 字元串;若無此參數名,返回 undefined。//調用方法:var 變數名 = getparameter("要擷取的參數名", url地址) var r = getparameter("age",url);
Time of Update: 2017-01-13
<!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"><head><meta
Time of Update: 2017-01-13
frame.html、top.html、bottom.html為例來具體說明如何做。 frame.html 由上(top.html)下(bottom.html)兩個頁面組成,代碼如下:現在假設top.html (即上面的頁面) 有七個button來實現對bottom.html (即下面的頁面) 的重新整理,可以用以下七種語句,哪個好用自己看著辦了。語句1. window.parent.frames[1].location.reload();語句2.
Time of Update: 2017-01-13
閏年的條件是符合下面兩個條件之一: 1、能被4整除,但不能被100整除; 2、能被4整除,又能被400整除)。因為能夠被400整除一定能被4整除所以 第二個條件可以簡化為能夠被400整除。0==y%4 && (0!=y%100 || 0==y%400) function fn_validatedate ( nyear , nmonth , nday
Time of Update: 2017-01-13
unicode編碼,一種全世界語言都包括的一種編碼。(國際化功能中常常用到)u4e00-u9fa5匹配中文字元也就是漢字的運算式。這個沒什麼介紹就是去找找哪個國家的語言在哪個範圍就是了。英文使用者名稱與中文function isabc (str) { if( /^(?:d|[u4e00-u9fa5]|[s,-,_.a-z]|[a-z]|)+$/.test(str) )
Time of Update: 2017-01-13
<!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"><head><meta
Time of Update: 2017-01-13
//得到每周的第一天(周一)function getfirstdateofweek(thedate){ var firstdateofweek; thedate.setdate(thedate.getdate() + 1 - thedate.getday()); firstdateofweek = thedate; return firstdateofweek; }//得到每周的最後一天(周日)function
Time of Update: 2017-01-13
如果要相容多瀏覽器就要判斷使用者的瀏覽器類型,如果是firefox還是ie6,7,8等,這樣可以根據他們不能的區別進行判斷再作操作。<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>無標題頁</title> <script language="網頁特效"
Time of Update: 2017-01-13
一、window對象 -------------------------------------------------- ------------------- 對象屬性 window //窗戶自身 window.self //引用本窗戶window=window.self window.name //為窗戶命名 window.defaultstatus //設定窗戶狀態列資訊 window.location //url地址,配備布置這個屬性可以開啟新的頁面