How To Add Functions To Javascript onload Over Third Party Scripts; Playing Nice如何添加功能的JavaScript的onload超過三分之一黨的腳本;發揮不錯
As a javascript developer using onload often you will find that other script authors too love to use onload.作為一個JavaScript的開發人員使用的onload往往你會發現其他腳本作者太愛使用的onload 。 Unfortunately onload accepts a function name and your reassigning will prevent others from using onload.可惜的onload接受一個函數的名稱和您的重新分配將防止其他人使用的onload 。 Here is a script which allows you to use onload even when others have used it and without breaking their script.這裡是一個腳本,這可以讓你用的onload ,甚至當別人都用它,並沒有打破他們的腳本。
The key idea is that you should be able to stack your function(s) above / below existing function call.關鍵的想法是,你應該可以堆疊您的函數( )以上/下面現有的函數調用。 Let’s look at the sample code below:讓我們看看示例代碼如下:
I think I have well commented the code to make the script self-explanatory, but feel to ask questions.我想我已經好評論的代碼,使腳本自我解釋性,但覺得發問。 The code has been tested on Firefox, Internet Explorer and Opera.代碼已經過測試,在Firefox , Internet Explorer和歌劇。
Filed under提起下 Browser瀏覽器 , , Firefox火狐 , , Headline News頭條新聞 , , How To如何 , , Internet Explorer Internet Explorer中 , , Javascript JavaScript的 , , Programming編程 , , Web網頁 , , Web 2.0 Web 2.0的 , , Web Services Web服務 | |
| |
RSS 2.0 2.0 | |
Trackback Trackback跟踪 this Article |此文章|
Email this Article電子郵件此文章
You may also like to read您也可以想讀 |




February 7th, 2007 at 10:34 pm 2007年2月7日在下午10時34分
Where is the sample code?哪裡是示例代碼?
February 8th, 2007 at 1:08 am 2007年2月8日在上午01時08分
hi there,喜有,
I don’t see any code — I use firefox 1.5.x on windows.我看不出有任何的代碼-我使用F irefox1 .5.x在W indows上使用。
Thank you,謝謝您,
BR,溴
~A 〜一
February 8th, 2007 at 3:09 am 2007年2月8日在上午03時09分
Thanks for the catch.感謝的漁獲量。 I forgot to escape the <’s and >’s我忘記了逃避<奇摩和“ >奇摩
April 30th, 2007 at 5:44 pm 2007年4月30日在下午5時44分
Thanks for the script!感謝腳本!
October 26th, 2007 at 6:30 am 2007年10月26日在上午06時30分
Great idea.的偉大構想。 I created a function, addEventHandler, that simplifies adding this technique to new Javascripts.我創建了一個功能, addeventhandler ,簡化了加入這一技術的新javascripts 。
Thanks for addressing this issue.感謝為解決這一問題。 It was a recent concern of mine.這是一個最近關注的礦井。