2008/09/23

[網頁設計] IE Fx 異同表(草稿)

早上整理之前在網路上找到的資料跟自已這半年來工作上的心得,寫了一個簡表:
* Q: 無法使用 document.form_name 得到 form object ?
* A: 請用 document.formname.elements["elementname"] 或 document.forms["form_name"] 或 forms 底下順序抓取 form object
* Q: IE 的 radio 在有 onclick 的 function event 時,不會再跑出來 check 事件。
* A: 解決之道 -> 另外再做 obj.checked = true;
* Q: obj.setAttribute 時 colspan 不作用
* A: 因為 IE 的 DOM 屬性名稱是 colSpan ,大小寫需注意。
* Q: obj.setAttribute("class", "class_name"); 無作用?
* A: 因為 IE 的 class 屬性名稱是 className,大小寫請注意。
* Q: (尚未確認) window.event 在 fx 的 function 之中無法使用。
* A: 請用 function (event) 的方式傳入 event object 給 fx 的 function 使用。

* Q: IE 中 target name 是 global 且為 document.name 所使用。
* A: 請避免這個使用方式。
* Q: 在 IE 中 event.x 與 event.y 在 fx 中未定義。
* A: 請避免使用這個變數,改用 event.client.x/y 。 (這個變數在 IE/fx 底下都有定義,但是與 event.x/y 有些許不同,請注意)
* Q: IE 中 frame name 在 window.frame_name 有定義。
* A: 請使用 frames["frame_name"] 取得 frame object

* Q: childNodes 的定義在 IE 與 fx 不同, IE 不會插入空白節點, fx 使用 DOM 標準規範,childNodes中會插入空白文本節點。
* A: 可以透過 node.getElementsbytagname() 來迴避這個問題。
* Q: fx 的節點沒有定義 removenode 的 method 。
* A: 使用如下方式處理 node.parentnode.removechild(node)。
* Q: IE 中對 const 無定義。
* A: 避免使用。
* Q: fx 的 body 在 body 標籤沒有被瀏覽器完全讀入之前就存在,而 IE 則在 body 被完全讀入之後才存在。
* A: 在實現過程中請小心注意。
* Q: IE 中 input type 是唯讀屬性, fx 是可以更改的屬性。
* A: 請小心避免修改 IE 中的 input 屬性。
* Q: (未確認)在 ie 中,getelementsbyname()、document.all[name] 均不能用來取得 div 元素。
* A: 請小心避免使用這個取得方式,改用 getElementById()。

1.4 其它類

* IE 的註解 // 做 End ,不然會出錯。 Fx 可以接受沒有 End Tag

// 呵,原表格是在 Wiki 上面寫的,應該丟到 wikibooks 還是 wikipedia 上面好呢?

沒有留言:

[Windows] git-bash 底下的工具

因為工作轉到 Windows 平台上的關係,所以很多工具改到 Windows 上面運作,跟著在 TortoiseGit 底下使用 git-bash 來維護自己的專案原始碼。結果就是裝了前面提過的 auto-hotkey 使用熱鍵來提昇自己的平台操作速度; 但除了 hotkey...