2014-08-31 40 views
0

我得到一個Uncaught ReferenceError:onload_functions未定義來自javascript的錯誤。 我在另一個網站上使用了相同的javascript(全部運行PHPBB; http://www.phpbb.com),但在我當前的網站上,javascript生成未捕獲的ReferenceError:onload_functions未定義錯誤。未捕獲ReferenceError:未定義onload_functions

function fontsizeup(e){if(e&&getKeyCode(e)==9){return true}var t=getActiveStyleSheet();switch(t){case"A--":setActiveStyleSheet("A-");break;case"A-":setActiveStyleSheet("A");break;case"A":setActiveStyleSheet("A+");break;case"A+":setActiveStyleSheet("A++");break;case"A++":setActiveStyleSheet("A");break;default:setActiveStyleSheet("A");break}return false}function fontsizedown(e){if(e&&getKeyCode(e)==9){return true}var t=getActiveStyleSheet();switch(t){case"A++":setActiveStyleSheet("A+");break;case"A+":setActiveStyleSheet("A");break;case"A":setActiveStyleSheet("A-");break;case"A-":setActiveStyleSheet("A--");break;case"A--":break;default:setActiveStyleSheet("A--");break}return false}function getKeyCode(e){var t=e.keyCode?e.keyCode:0;if(!t&&e.charCode){t=e.charCode}return t}function setActiveStyleSheet(e){var t,n,r;for(t=0;n=document.getElementsByTagName("link")[t];t++){if(n.getAttribute("rel").indexOf("style")!=-1&&n.getAttribute("title")){n.disabled=true;if(n.getAttribute("title")==e){n.disabled=false}}}}function getActiveStyleSheet(){var e,t;for(e=0;t=document.getElementsByTagName("link")[e];e++){if(t.getAttribute("rel").indexOf("style")!=-1&&t.getAttribute("title")&&!t.disabled){return t.getAttribute("title")}}return null}function getPreferredStyleSheet(){return"A-"}function createCookie(e,t,n){if(n){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3);var i="; expires="+r.toGMTString()}else{i=""}document.cookie=e+"="+t+i+style_cookie_settings}function readCookie(e){var t=e+"=";var n=document.cookie.split(";");for(var r=0;r<n.length;r++){var i=n[r];while(i.charAt(0)==" "){i=i.substring(1,i.length)}if(i.indexOf(t)==0){return i.substring(t.length,i.length)}}return null}function load_cookie(){var e=readCookie("style_cookie");var t=e?e:getPreferredStyleSheet();setActiveStyleSheet(t)}function unload_cookie(){var e=getActiveStyleSheet();createCookie("style_cookie",e,365)}onload_functions.push("load_cookie()");onunload_functions.push("unload_cookie()"); 

每次都會發生此錯誤。 我正在運行PHPBB論壇軟件和自定義主題。 這是Styleswitcher.js

回答

0

嘗試定義onload_functionsonunload_functions起初:

var onload_functions = []; 
var onunload_functions = []; 
+0

謝謝SOOO了! 它的工作! – juyoung518 2014-08-31 12:50:57

相關問題