|
|
Can I divide data file of my script drop down menu on several files?
Return to Recent Questions
Q:
I will create script drop down menu for several books’ Contents,
each book is more than 100 lines and has links. I
think if I will have all the books’ contents in 1 *.JS file then
it will be TOO LOONG!!.
How I can break it down to 1 book for 1*.JS ?
A:
You cannot divide your menuItems parameter.
You can only use one .js file for your script drop down menu parameters and the other
.js file for your menuItems = [...];
1) You can try to add the following code.
In the first file (@MY books (Multiple Col.js) I write menuItems for the first item "AC-DC".
Notice that you should delete comma at the end of the last item
var menuItems = [
["AC-DC","", , , , , , , , ],
["|@Book1","testlink.htm", , , , , , , , ],
...
["|@Book3","", , , , , , , , ],
["||CH02","", , , , , , , , ],
["||CH01","", , , , , , , , ] // delete comma at the end of the last item
];
In the second file (@MY books (1.js) you should write
menuItems = menuItems.concat(
[
["ANLOG","", , , , , , , , ],
["|@Book1","", , , , , , , , ],
["|@Book2","", , , , , , , , ],
["|@Book3","", , , , , , , , ] // delete comma at the end of the last item
]
);
In the third file (@MY books (2.js) you should write
menuItems = menuItems.concat(
[
["DIGITAL","", , , , , , , , ],
["|Item 1332","", , , , , , , , ],
["WinXP","", , , , , , , , ],
["|Item 1333","", , , , , , , , ],
["MS-Word","", , , , , , , , ],
["|Item 1334","", , , , , , , , ],
["MS-Excel","", , , , , , , , ],
["|Item 1335","", , , , , , , , ] // delete comma at the end of the last item
]
);
dm_init();
Notice that you should write dm_init(); function in the last file.
In the .html file you should write
...
<tr>
<script type="text/javascript" src="@MY books (Multiple Col.js"></script>
<script type="text/javascript" src="@MY books (1.js"></script>
<script type="text/javascript" src="@MY books (2.js"></script>
</tr>
I hope you understand me.
2) Try to use several menus on the one page, for example:
param.js // file with menu parameters (all parameters before menuItems = [...]; array)
menu1.js // menuItems for "AC-DC", "ANLOG"
menu2.js // menuItems for "DIGITAL", "WinXP"
menu3.js // menuItems for "MS-Word", "MS-Excel"
In these script drop down menu files you should write
menuItems = [
...
];
dm_init();
Then you should install your script drop down menu in the following way
<script type="text/javascript" src="param.js"></script>
<table>
...
<script type="text/javascript" src="menu1.js"></script>
...
<script type="text/javascript" src="menu2.js"></script>
...
<script type="text/javascript" src="menu3.js"></script>
But it will be easier to use script drop down menu in such case
var isHorizontal=0;
var smColumns=1;
Return to Recent Questions
Related:
- March 23, 2009 - Submenus of the script drop down menu disappears not fast enough...
- Apr 09, 2009 - My script drop down menu disappears on the home page.
- Apr 26, 2009 - I need to be able to automatically wrap the line in the script drop down menu.
- May 31, 2009 - I set a target at '_mainFrame' for my script drop down menu but it opens in the same window.
- Jun 18, 2009 - Is there a way to show a links like I have in the script drop down menu if the JavaScript is not allowed on computer?
- Jul 05, 2009 - Can you walk me through the creating of a script drop down menu?
- Jul 22, 2009 - How to use a script drop down menu item so that it opens a window at a certain size?
- Jul 31, 2009 - How to add the new items to the javascript onmouseover menu without using two data files?
- Aug 08, 2009 - I want only one column of submenu in script drop down menu to be displayed, all other columns should be closed.
- Aug 25, 2009 - My script drop down menu doesn't work in at Dreaweaver template - why?!
- Sep 06, 2009 - Where I can find data.js file for menue script?
|