function Base(){}Base.prototype = {x:10, y:[]}function A(){}A.prototype = new Base();var a = new A();a.y.push("first");a.x = 9;console.log(a.x);console.log(a.y);function B(){}B.prototype = new Base();var b = new B();b.y.push("second");b.x =
function Close() { var ua=navigator.userAgent var ie=navigator.appName=="Microsoft Internet Explorer"?true:false if(ie) { var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE ")))) if(IEversion< 5.5) { var
來源:http://www.cnblogs.com/jianyi0115/articles/677712.htmlhttp://www.cnblogs.com/fxwdl/archive/2009/09/13/1565795.html在此作備忘:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 <!DOCTYPE html PUBLIC "
在網上看到有不少JS設計模式的樣本。今天參照:http://www.cnblogs.com/iloveu/archive/2009/03/31/1426234.html寫了一下,記錄在此,僅作備忘:Code highlighting produced by Actipro CodeHighlighter
修改地址後的參數:<script>function getNewUrl(oldurl,paramname,pvalue){ var reg = new RegExp("(\\?|&)"+ paramname +"=([^&]*)(&|$)","gi"); var t=oldurl.match(reg)[0]; var retxt=t.substring(0,t.indexOf("=")+1)+pvalue; if(t.charAt(t.
無意中發現這樣一個現象,JavaScript可以根據瀏覽器類別決定是否註冊函數。樣本:1if(document.all)2{3 function al(){alert('aa');}4}5al()在IE和FF下運行時,在IE下將彈出'aa'對話方塊。而在FF下將不會。換成如下代碼:1if(!document.all)2{3 function al(){alert('aa');}4}5al()在IE下和FF下都可以alert('aa');不明白的地方,既然if(document.all)可以實
先上代碼:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.
今天在藍色中看到一篇文章,對js 中布爾型及==運算子進行了一番比較分析。不看不知道,一看嚇一跳,平時還真的沒有注意到這麼細節的東西:所謂大牛與菜鳥,估計這是重要的區別之一了。說到布爾型,估計不少人都知道JS中非0即為true,那麼請您運行一下下面這兩行代碼:Code highlighting produced by Actipro CodeHighlighter
大家應該知道,在C#中對於屬性、檔案等的更改監視非常簡單,因為有委託(事件)、FileSystemWatcher等好東東扶持。那麼在JavaScript中,如何對變數的更改進行監視呢?首先,我仿照c#的屬性來對JS進行操作,寫出了如下的樣本:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 function Class1() 2
click() 對象.click() 使對象被點擊。closed 對象.closed 對象視窗是否已關閉true/falseclearTimeout(對象) 清除已設定的setTimeout對象clearInterval(對象) 清除已設定的setInterval對象confirm("提示資訊") 彈出確認框,確定返回true取消返回falsecursor:樣式 更改滑鼠樣式 hand crosshair text wait help default auto e/s/w/n-