Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP - JSCookMenu problem

Status
Not open for further replies.

whitergmx

Technical User
Mar 25, 2004
6
GB
I am trying (for first time) to get Yuan Heng's JSCookMenu to work.

I have placed "JSCookMenu.js" in the main web directory (ie. in , and created a folder called ThemeIE (ie. to hold the image files, and the "theme.css" and "theme.js" files.

I have edited "theme.js" script, and changed the first line to:-
var cmThemeIEBase = 'ThemeIE/';
(previously it referred to '/~heng/JSCookMenu/ThemeIE/')

(I've also tried the script with '/ThemeIE/' instead of 'ThemeIE/' - no difference!)

Lastly I've created the following test.htm to check if it works - but I ALWAYS get script error that "myMenu" is undefined.

Can anyone tell me what's wrong please? Better still, what I need to do to code this correctly?

Thanks
-------------------

<html>
<head>


</head>

<body link="#000080" vlink="#800080" text="#FFFF00" bgcolor="#0000FF" alink="#FF0000">


<DIV ID="MenuDefinition">
<SCRIPT LANGUAGE="text/javascript" SRC="JSCookMenu.js"></SCRIPT>

<LINK REL="stylesheet" HREF="ThemeIE/theme.css" TYPE="text/css">
<SCRIPT LANGUAGE="text/javascript" SRC="ThemeIE/theme.js"></SCRIPT>

<SCRIPT LANGUAGE="text/javascript">
<!-- var myMenu =
[
[null,'Home',' to Home page',
[null,'Welcome',' to Home page'],
[null,'Contact Us',' information']
],
[null,'News',' pages',
[null,'News Index',' news index']
]
];
-->
</SCRIPT>

<DIV ID='myMenuID'></DIV>

<SCRIPT LANGUAGE="JavaScript"><!--
cmDraw ('myMenuID', myMenu, 'hbr', cmThemeIE, 'ThemeIE');
--></SCRIPT>

</DIV>

</body>
</html>
 
Probably not related to your problem is that these three lines
Code:
<SCRIPT LANGUAGE="text/javascript" SRC="JSCookMenu.js"></SCRIPT>

<LINK REL="stylesheet" HREF="ThemeIE/theme.css" TYPE="text/css">
<SCRIPT LANGUAGE="text/javascript" SRC="ThemeIE/theme.js"></SCRIPT>
should probably all be in the HEAD section of your code.

However, the problem here has to do with your LANGUAGE parameters in your SCRIPT tags surrounding the def of myMenu and the call to cmDraw(...). In IE6, I found that if I just took these parameters out, it all worked fine.

If you want to specify the JavaScript, then try the parameter type='text/JavaScript'. This worked for me as well.

Oh... another problem I found was that the code didn't like the definition of myMenu starting on the same line as the open-comment tag. But when I changed:
Code:
<!-- var myMenu...

to

Code:
<!--
var myMenu
...

...THEN it worked fine.

'hope this helps.

--Dave
 
Based on what I've seen in other postings, I think the more-correct LANGUAGE parameter in your SCRIPT tags would be:

Code:
language='JavaScript'
(WITHOUT the word text/ in the value).

--Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top