Javascript Function not displaying correctly in menu item

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
PCAKen
Beginner
Beginner
Posts: 7
Joined: Wed Jun 30, 2004 4:59 pm

Javascript Function not displaying correctly in menu item

Post by PCAKen »

I have the most recent version of Milonic DHTML Menu (downloaded yesterday) and I am trying to create a menu item for a link to a pop-up chat room.

Here is the line from my file:

aI("text=Chat Room;url=JavaScript:openWindow6('chat/chatroom.asp');image=http://www.kcrpca.org/images/chatrm5.gif;");


This does create a menu item, you can browse to http://www.kcrpca.org and see this for yourself.

However, where the text is that says "Chat Room" the link if you over over it is actually Javascript:openWindow6(

If you move your cursor to the right of the words Chat Room, then the link becomes what it should be: Javascript:openWindow6('chat/chatroom.asp') and the function works correctly and the Chat Room is opened.

Is there a fix for this behavior so that hovering over the words Chat Room in the menu item displays the link correctly?
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi,

You'll need to decalre a status for the links that are pointing to javaScript functions.

You can declare an empty status if you need to clear the status bar completely:

Here's how:

Code: Select all

aI("text=Chat Room;url=JavaScript:openWindow6('chat/chatroom.asp');image=http://www.kcrpca.org/images/chatrm5.gif;status=;"); 
Cheers
Andy
PCAKen
Beginner
Beginner
Posts: 7
Joined: Wed Jun 30, 2004 4:59 pm

Post by PCAKen »

Yep that worked, thanks for the fast reply.

One other quick question, how do you incorporate a horizontal divider line in a vertical menu to group some items together visually?
PCAKen
Beginner
Beginner
Posts: 7
Joined: Wed Jun 30, 2004 4:59 pm

Post by PCAKen »

Hmm I spoke to soon, on another menu item for pending tasks that also uses a Javascript function I am getting the same sort of results, even if I add a null status value. The only difference in the 2 menu items is that on the second one I am running some ASP code inline to count the number of tasks and display it in the menu line.

Here's the line I am using:

aI("text=Pending Tasks (<% =totalrcount %>);url=JavaScript:MM_showHideLayers('pending','','show');image=http://www.kcrpca.org/images/tasks2.jpg;status=;");


Thoughts?
PCAKen
Beginner
Beginner
Posts: 7
Joined: Wed Jun 30, 2004 4:59 pm

Post by PCAKen »

Andy,

This still isn't working, and after adding some spacers the blank status on that one line quit working. Please check my site http://www.kcrpca.org and you'll see what I mean.

Thanks in advance!
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,

Try using escaped double-quotes instead of single quotes around literal string parameters in the funciton call. I.e., use

Code: Select all

...url=javascript:functionName(\"param1\",\"param2\")...
instead of

Code: Select all

...url=javascript:functionName('param1','param2')...
Kevin
PCAKen
Beginner
Beginner
Posts: 7
Joined: Wed Jun 30, 2004 4:59 pm

Post by PCAKen »

I found another error where I had missed something, but it was unrelated to the formatting of this. I tried your suggestion above and so far it seems to be working, at least in IE, I need to test it with some other browsers too. (Although IE was the only one where it was truncating before)

Thanks a bunch!
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

The chat link gives a window with a clock, which becomes a form box with pick nickname or something like that in Netscape 4.79, 6.1, 7, Opera 6.05, Firebird [fox] .07, IE 5.5. It doesn't work in Opera 7.11. You get the hand but nothing happens when you click the chat room link. Win98se.

Ruth
PCAKen
Beginner
Beginner
Posts: 7
Joined: Wed Jun 30, 2004 4:59 pm

Post by PCAKen »

Thanks for letting me know, but I was under the impression that the chat room was entirely a Flash application, and therefore, was browser neutral. Does Opera 7.11 do something different with Flash?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

I meant that in Opera 7.11 when you mouseover the 'chat room' link in the menu the pointer changes to the hand but nothing happens when you click it. It's as if it's not a link, no window opens.

Ruth
Last edited by Ruth on Fri Jul 02, 2004 9:14 pm, edited 2 times in total.
PCAKen
Beginner
Beginner
Posts: 7
Joined: Wed Jun 30, 2004 4:59 pm

Post by PCAKen »

Any idea why that doesnt work in Opera? Is it the link itself or is it the Javascript that should pop the window? I think we can find out if you look around that website there are other javascript window-popping links, for example the details of a calendar event I believe are popped via javascript in the same way. If those links don't work for you (simple HTML links) then the problem is that Opera doesn't support whatever that javascript is doing. If those links work for you then the problem is that Opera doesn't interpret the menu item the same way as other browsers.

I'm not sure I could fix either, but it would be interesting to know.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

They don't work either, so it's an opera problem with that.

Ruth
Post Reply