layersmenu.jsでのJavaScriptエラー
投稿者: takumihp | 投稿日時: 2006-2-17 14:59 | 閲覧: 4017回
はじめまして。
XOOPS初心者のtakumihpと申します。
xoops-2.0.13a-JP、IE6.0を使用しています。
管理画面を開く度に、ポップアップウインドウでエラーが表示されてしまいます。
<エラーメッセージここから>
ランタイムエラーが発生しました。
デバックしますか?
行:25
エラー:オブジェクトがありません。
<エラーメッセージここまで>
デバッグウインドウを立ち上げて見ると、/include/layersmenu.jsファイルでエラーが起こっているようです。
参考までに25行目を含むlayersmenu.jsの一部を書きます。
// PHP Layers Menu 1.0.7 (c) 2001, 2002 Marco Pratesi
DOM = (document.getElementById) ? 1 : 0;
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
var loaded = 0; // to avoid stupid errors of Microsoft browsers
Konqueror = (navigator.userAgent.indexOf("Konqueror") > -1) ? 1 : 0;
// We need to explicitly detect Konqueror
// because Konqueror 3 sets IE4 = 1 ... AAAAAAAAAARGHHH!!!
Opera5 = (navigator.userAgent.indexOf("Opera 5") > -1 || navigator.userAgent.indexOf("Opera/5") > -1 || navigator.userAgent.indexOf("Opera 6") > -1 || navigator.userAgent.indexOf("Opera/6") > -1) ? 1 : 0;
// it works with NS4, Mozilla, NS6, Opera 5 and 6, IE
currentY = -1;
function grabMouse(e) {
if ((DOM && !IE4) || Opera5) {
currentY = e.clientY;
} else if (NS4) {
currentY = e.pageY;
} else {
currentY = event.y;
}
if (DOM && !IE4 && !Opera5 && !Konqueror) {
currentY += window.pageYOffset;
} else if (IE4 && DOM && !Opera5 && !Konqueror) {
25行目⇒ currentY += document.body.scrollTop;
}
}
どういう原因でエラーが発生したのでしょうか?
また、エラーを回避するにはどうしたらいいのでしょうか?
すみませんが、ご教示ねがいます。
この質問は以前にも旧フォーラムで投稿されています。
http://jp.xoops.org/modules/newbb/viewtopic.php?topic_id=9201&forum=11&post_id=44583
しかし、有効な解決策が提示されていなかったので、投稿しました。
XOOPS初心者のtakumihpと申します。
xoops-2.0.13a-JP、IE6.0を使用しています。
管理画面を開く度に、ポップアップウインドウでエラーが表示されてしまいます。
<エラーメッセージここから>
ランタイムエラーが発生しました。
デバックしますか?
行:25
エラー:オブジェクトがありません。
<エラーメッセージここまで>
デバッグウインドウを立ち上げて見ると、/include/layersmenu.jsファイルでエラーが起こっているようです。
参考までに25行目を含むlayersmenu.jsの一部を書きます。
// PHP Layers Menu 1.0.7 (c) 2001, 2002 Marco Pratesi
DOM = (document.getElementById) ? 1 : 0;
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
var loaded = 0; // to avoid stupid errors of Microsoft browsers
Konqueror = (navigator.userAgent.indexOf("Konqueror") > -1) ? 1 : 0;
// We need to explicitly detect Konqueror
// because Konqueror 3 sets IE4 = 1 ... AAAAAAAAAARGHHH!!!
Opera5 = (navigator.userAgent.indexOf("Opera 5") > -1 || navigator.userAgent.indexOf("Opera/5") > -1 || navigator.userAgent.indexOf("Opera 6") > -1 || navigator.userAgent.indexOf("Opera/6") > -1) ? 1 : 0;
// it works with NS4, Mozilla, NS6, Opera 5 and 6, IE
currentY = -1;
function grabMouse(e) {
if ((DOM && !IE4) || Opera5) {
currentY = e.clientY;
} else if (NS4) {
currentY = e.pageY;
} else {
currentY = event.y;
}
if (DOM && !IE4 && !Opera5 && !Konqueror) {
currentY += window.pageYOffset;
} else if (IE4 && DOM && !Opera5 && !Konqueror) {
25行目⇒ currentY += document.body.scrollTop;
}
}
どういう原因でエラーが発生したのでしょうか?
また、エラーを回避するにはどうしたらいいのでしょうか?
すみませんが、ご教示ねがいます。
この質問は以前にも旧フォーラムで投稿されています。
http://jp.xoops.org/modules/newbb/viewtopic.php?topic_id=9201&forum=11&post_id=44583
しかし、有効な解決策が提示されていなかったので、投稿しました。
コメント(1)
新しいものから |
古いものから |
ネスト表示 |
Re: layersmenu.jsでのJavaScriptエラー
投稿者: nobu | 投稿日時: 2006-3-2 1:53
なにげに直してみました。(場当たり的ですが)
以下 diff 形式の差分 (行頭の '-' は削除行、'+' は追加行)
行が長すぎ。ごめん。orz
以下 diff 形式の差分 (行頭の '-' は削除行、'+' は追加行)
--- include/layersmenu.js 2004-09-09 14:15:02.000000000 +0900
+++ include/layersmenu.js 2006-03-02 01:36:41.831290000 +0900
+++ layersmenu.js 2006-03-02 01:48:59.061290000 +0900
@@ -1,13 +1,13 @@
// PHP Layers Menu 1.0.7 (c) 2001, 2002 Marco Pratesi <pratesi@telug.it>
-DOM = (document.getElementById) ? 1 : 0;
-NS4 = (document.layers) ? 1 : 0;
-IE4 = (document.all) ? 1 : 0;
+var DOM = (document.getElementById) ? 1 : 0;
+var NS4 = (document.layers) ? 1 : 0;
+var IE4 = (document.all) ? 1 : 0;
var loaded = 0; // to avoid stupid errors of Microsoft browsers
-Konqueror = (navigator.userAgent.indexOf("Konqueror") > -1) ? 1 : 0;
+var Konqueror = (navigator.userAgent.indexOf("Konqueror") > -1) ? 1 : 0;
// We need to explicitly detect Konqueror
// because Konqueror 3 sets IE4 = 1 ... AAAAAAAAAARGHHH!!!
-Opera5 = (navigator.userAgent.indexOf("Opera 5") > -1 || navigator.userAgent.indexOf("Opera/5") > -1 || navigator.userAgent.indexOf("Opera 6") > -1 || navigator.userAgent.indexOf("Opera/6") > -1) ? 1 : 0;
+var Opera5 = (navigator.userAgent.indexOf("Opera 5") > -1 || navigator.userAgent.indexOf("Opera/5") > -1 || navigator.userAgent.indexOf("Opera 6") > -1 || navigator.userAgent.indexOf("Opera/6") > -1) ? 1 : 0;
// it works with NS4, Mozilla, NS6, Opera 5 and 6, IE
currentY = -1;
@@ -22,7 +22,11 @@
if (DOM && !IE4 && !Opera5 && !Konqueror) {
currentY += window.pageYOffset;
} else if (IE4 && DOM && !Opera5 && !Konqueror) {
- currentY += document.body.scrollTop;
+ if (document.documentElement) {
+ currentY += document.documentElement.scrollTop;
+ } else {
+ currentY += document.body.scrollTop;
+ }
}
}
if ((DOM || NS4) && !IE4) {
@@ -99,7 +103,7 @@
if (DOM) {
// attenzione a "px" !!!
if (e && e.clientY) { // just use the pos of the mouseOver event if we have it
- document.getElementById(menuName).style.top = e.clientY + 'px';
+ document.getElementById(menuName).style.top = currentY + 'px';
} else {
appoggio = parseInt(document.getElementById(menuName).style.top);
if (isNaN(appoggio)) appoggio = 0;
行が長すぎ。ごめん。orz


