Time of Update: 2018-12-03
下面是我設計的一個的javascript程式,雖然簡單,但卻給我帶來了極大的便利。我一直用它來調試一些javascript程式,用來測試Regex匹配,除了具備一般字元串的尋找替換功能外,還可以通過使用Regex來實現一般的文字編輯器所不具備的進階尋找/替換功能。使用很簡單了,在文字框輸入一段javascript程式,單擊執行指令碼程式按鈕即可運行程式,如果程式出錯會給出詳細的錯誤資訊。在文字框輸入一段文字,在查詢運算式框輸入運算式(可以是一般字元串或Regex),在替換框輸入替換文本,然後執行
Time of Update: 2018-12-03
JavaScript用canvas元素實現 2D 和 3D 我幾乎半年沒寫部落格了,哈哈先來個問候語。 可能有些人早就知道,canvas 這個元素,這個是在 w3c HTML5.0 方案確定的元素, 可惜的是 IE 不支援這個元素,Firefox在很早的版本就支援了這個元素, 下面是一些瀏覽器支援 canvas 元素預覽圖。 FirefoxSafariOperaExplorerCanvas2.0 ○2.0 ○9.2 ○0002 △3.0 ○3.0 ○9.5
Time of Update: 2018-12-03
<OBJECT id=WebBrowser height=0 width=0 classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></OBJECT><INPUT onclick=document.all.WebBrowser.ExecWB(1,1) type=button value=開啟 name=Button1> <INPUT
Time of Update: 2018-12-03
用javascript產生xml文中盡量用上所有的操作和屬性,以作總結 <script language="javascript"> <!-- var doc = new ActiveXObject("Msxml2.DOMDocument"); //ie5.5+,CreateObject("Microsoft.XMLDOM") //載入文檔 doc.load("C:/Tomcat5/webapps/CBF/b.xml");doc.async = false; doc.reso
Time of Update: 2018-12-03
在js裡用到數組,比如 多個名字相同的input, 若是動態產生的, 提交時就需要判斷其是否是數組.if(document.mylist.length != "undefined" ) {} 這個用法有誤.正確的是 if( typeof(document.mylist.length) != "undefined" ) {}或 if( !isNaN(document.mylist.length) ) {}typeof的運算數未定義,返回的就是 "undefined".運算數為數字
Time of Update: 2018-12-03
我們知道,父類中的屬性有this、static和prototype三種。我們常用的繼承方式有兩種:原型繼承:可以把父類的prototype屬性全部繼承下來對象冒充:可以將父類的this屬性繼承下來,再配合for...in迴圈,可以將父類的static屬性也繼承下來將這兩種方式綜合使用,並在此基礎上,使用delete刪除不需要的屬性,以及通過重寫方法來覆蓋父屬性,以達到完美繼承的效果。/** * Filename: PrefectExtend.js * Description:
Time of Update: 2018-12-03
V8 JavaScript Engine 的文檔非常少,我只找到兩篇:1. 官方的Embedder's Guide:http://code.google.com/apis/v8/embed.html 這裡是翻譯:http://blog.csdn.net/ffr225/archive/2010/08/13/5809766.aspx2. CodeProject 上的一篇Using V8 - Google's Chrome JavaScript Virtual Machine
Time of Update: 2018-12-03
Prototype對該對象的對象原型的引用。對於所有的對象,它預設返回 Object 對象的一個執行個體。<html><mce:script type="text/javascript"><!--Object.prototype.test = "prototype.test";var obj = new Object();obj.test = "test";alert(obj.test);//testvar obj2 = new
Time of Update: 2018-12-03
<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>table Page</title></head><body> <form id="form1" runat="server"> <div style="width:500px"> <table id ="AllTable"
Time of Update: 2018-12-03
是不是經常看到這樣的情況,當你按下一個連結,提示資訊就告訴你是否願意把該頁設定為首頁,如果你選擇是,那麼今後開啟瀏覽器的首頁就成為當前頁了。請看一看下面的簡單的原始碼:<a class="chlnk" style="cursor:hand" HREF="#" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.5dmedia.com');return false;"
Time of Update: 2018-12-03
最近作一些東西,要用到數組,想用字串作為數組的索引,這其實就是關聯陣列了。但是這些字串又是臨時添加進取的,我要從數組取資料的時候,並不知道這些字串都是什麼,如果用數字作索引,那麼字串的資訊就丟失了。最後,通過尋找知道,像對象一樣訪問數組就可以解決問題了。例子如下:function test(){ var oneArray=new Array(); oneArray["first"]="firstValue"; oneArray["second"]="se
Time of Update: 2018-12-03
<html><head><title></title><script language="javascript" type="text/javascript">function createElement(tagName, type){ var element = null; try { element = document.createElement('<' + tagName + ' name="'+n
Time of Update: 2018-12-03
以前一直不知道好多網站上所說的線上編輯器是怎麼回事,後來在文檔裡發現document 對象的一個方法。document.execCommand(command, false, value);才知道具體原理。一、首先來看一個例子:<DIV contenteditable="true" style="border:dashed blue 2px">Hello World!</DIV>儲存為html網頁,開啟看看,在DIV裡出現了一個游標,這個DIV就變成可以編輯的了。類似的,
Time of Update: 2018-12-03
用javascript來判斷瀏覽器是否禁止了快顯視窗,並在網頁中以友好的方式來提示網站瀏覽者Pop-up Blocker或其他屏蔽快顯視窗廣告的軟體(如google的工具條)會屏蔽除了除createPopup()之外的從指令碼自動開啟的任何視窗。受此影響的一些常用函數是:window.open(), showModelessDialog(), showModalDialog(), showHelp(), window.external.NavigateAndFind()。用下面的js可以檢測到,
Time of Update: 2018-12-03
<body><SCRIPT LANGUAGE="JavaScript"> var s = "網頁可見地區寬:"+ document.body.clientWidth; s += "/r/n網頁可見地區高:"+ document.body.clientHeight; s += "/r/n網頁可見地區寬:"+ document.body.offsetWeight +" (包括邊線的寬)"; s += "/r/n網頁可見地區高:"+
Time of Update: 2018-12-03
大家好!!今晚在華軟G43*宿舍沒什麼事做,把javascript中replace方法講解一下,如果講得不對或不合理是情理之中的事,因為我不是老鳥,也不是菜鳥,我也不知道我當底是什麼鳥??呵~~ replace方法的文法是:stringObj.replace(rgExp, replaceText)
Time of Update: 2018-12-03
1) 對象冒充//繼承第一種方式:對象冒充function Parent(username){ this.username = username; this.sayHello = function() { alert(this.username); }}function Child(username, password){ //下面三行代碼是最關鍵的代碼 this.method = Parent; this.method(username)
Time of Update: 2018-12-03
用法:<script src="../cgi-bin/delscript.js" defer></script> defer作用是文檔載入完畢了再執行指令碼,這樣迴避免找不到對象的問題 加上 defer 等於在頁面完全在入後再執行,相當於 window.onload ,但應用上比 window.onload
Time of Update: 2018-12-03
1. window.event 現象:document.body.onclick=function(ev){if(ev)console.log(1); else console.log(2); }IE8以下不支援這種寫法。document.body.onclick=function(){if(window.event)console.log(1); else console.log(2); }FF 不支援這種寫法。IE9、chrome
Time of Update: 2018-12-03
可以滑動的div塊<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>滑動的div</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta