Milonic and Opera 7.54

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
mpappert
Beginner
Beginner
Posts: 9
Joined: Mon Aug 09, 2004 1:14 pm

Milonic and Opera 7.54

Post by mpappert »

I have setup my Milonic menu and have tested it under IE6, IE6 wSP2, Firefox 0.9.3 and am now trying Opera 7.54 ... and the problem surfaces! LOL

In the other browsers the following line of code works (as a menu item):

Code: Select all

aI("text=Send Feedback;url=javascript:popupWindow('http://www.mdocs.ca/feedback.htm','feedback',460,445,0,0,'yes','no','no','no');");
However, in Opera, this code is never even executed! At the entry point in the function I added a document.write('Entry Point'); and in every browser it displays this text, Opera however, it does not ...

Any suggestions?

Thanks!
M.
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi M.

Can you post the code for the popupWindow() function?

I'm assuming its a wrapper for the window.open() method, and that the parameters are probably url, window name, width, height, top, left, scrollbars, resizable, etc... There are some attributes in the js window.open() method that are often used but that aren't recognized in all browsers (left and top for example). Of course, if the function isn't even entered, that wouldn't be the explanation. Then again, some browsers also handle document.write() differently... maybe try an alert() at the top of the function instead, just to be sure.

Kevin
mpappert
Beginner
Beginner
Posts: 9
Joined: Mon Aug 09, 2004 1:14 pm

Post by mpappert »

Hey Kevin,

I have done more testing and it definitely seems like its an Opera bug ... I've tried the alert and nothing. The code can be viewed here:

http://www.mdocs.ca/scripts/common.js

If I turn on the Opera javascript error window, it shows the following error:

http://www.mdocs.ca/scripts/common.js
Unknown context
Syntax error while loading (line 61)

-^
line 61 is the closing } of the popupWindow function ... so not sure why this error is being generated. I've tested it under IE6 (with and without SP2) and Firefox 0.9.3 without problems.

When I click the link, the following text is produced in the error window:

http://www.mdocs.ca/alpha_v1d814.htm
Javascript URL thread: "javascript:popupWindow('http://www.mdocs.ca/feedback.htm','feed ... o','no','n..."
Error:
name: ReferenceError
message: Statement on line 1: Reference to undefined variable: No such variable 'popupWindow'
Backtrace:
In unknown script
popupWindow("http://www.mdocs.ca/feedback.htm", "feedback", 460, 415, 0, 0, "yes", "no", "no", "no");


Not sure why it thinks popupWindow is a variable - I'm guessing for whatever reason, it's not linking the common.js file properly?

It's got me for now! LOL

Thanks!
M.
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi M.

Looks like Opera 7.54 has decided to be a pain and not be as forgiving in parsing js code as some other browsers (or even as forgiving as it used to be... the error doesn't occur in Opera 7.20). Then again, it seems to me that Opera is always a pain about something ;)

Anyways... thanks for the thorough post... definitely makes it easier to help. The problem is in the last line of code in the common.js file:

Code: Select all

} <!-- End Function -->
There's js code and html code on the same line... the closing curly brace for the popupWindow() function is followed by an html comment. So, it looks like Opera never finished reading the function. Therefore, to Opera, the function (which Opera annoyingly calls a variable rather than an object) doesn't exist. If you move the End Function comment down to the next line, like so:

Code: Select all

} 
<!-- End Function -->
or if you leave it on the same line but put a // in front of the <!--, or if you get rid of it altogether, then the problem should go away.

Hope that helps,

Kevin
mpappert
Beginner
Beginner
Posts: 9
Joined: Mon Aug 09, 2004 1:14 pm

Post by mpappert »

Thanks Kevin! I replaced all the <!-- --> comments with // comments, and now it works!

Cheers!
M.
Post Reply