Recent Questions
Q: Submenus of my javascript dynamic menu are opening higher than they should and I cannot figure out why the position setting has no effect.
A: Try to set the following parameter:
var subMenuVAlign="top";
Q: I will build menu for several books’ Contents, each book is more than 100 lines and has links. I think if all the books’ contents in 1 *.JS file then it is TOO LOONG!!.
Can I break it down to 1 book for 1*.JS ? How?
A: You cannot divide your menuItems parameter.
You can only use one .js file for your menu parameters and the other.js file for your menuItems = [...];
But you can do it in two ways.
1) You can try to use several menus on the one page, for example:
param.js // file with menu parameters (all parameters before menuItems = [...];)
menu1.js // menuItems for "AC-DC", "ANLOG"
menu2.js // menuItems for "DIGITAL", "WinXP"
menu3.js // menuItems for "MS-Word", "MS-Excel"
In these menu files you should write
menuItems = [
...
];
dm_init();
Then you should install your 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 vertical menu in such case
var isHorizontal=0;
var smColumns=1;
2) You can also try to add some code, see the attached example.
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.
Q: I’d like to know how to populate the navigation bar menu from a database?
A: Please, see the example of .php file.The content of .php file depends on your database structure.
<?php
// The example for PHP/MySQL.
// MySQL database has the table "menuTable" that contains data for menu items.
// The table has the following fields:
// 1. "text" - item text
// 2. "link" - item link
// 3. "icon1" - item icon (normal state)
// 4. "icon2" - item icon (mouseover state)
function getMenuItems()
{
$jsItems = '';
// Select all records from table "menuTable"
$allItems = mysql_query('SELECT * FROM menuTable;');
// Extract items data from database and build Javascript code for menuItems
while ($itemData=mysql_fetch_array($allItems))
{
$jsItems .= '["'.$itemData['text'].'", "'.$itemData['link'].'", "'.$itemData['icon1'].'", "'.$itemData['icon2'].'"],';
}
// Return Javascript code
return $jsItems;
}
?>
<script>
var menuParam1 = value1;
var menuParam2 = value2;
var menuParam2 = value2;
...
var menuItems = [
// Write Javascript code for menu items
echo getMenuItems();
?>
];
</script>
Q: Can I put two popup windows in one HTML file?
One popup for example after 1 second, and disappear after 10
The second one after 15 second and disappear after 30 seconds.
Can you help me?
A: You should set the following parameters for the first window:
winID:"window1",
openAfter:1,
closeAfter:10,
for the second window:
winID:"window2",
openAfter:15,
closeAfter:30,
See also how should you install popup windows on your page:
<head>
<!-- Deluxe Popup Window -->
<noscript><a href="http://deluxepopupwindow.com">DHTML Window Script by DeluxePopupWindow.com</a></noscript>
<script type="text/javascript"> var dmWorkPath="deluxe-popup-window.files/";</script>
<script type="text/javascript" src="deluxe-popup-window.files/dpopupwindow.js"></script>
<!-- (c) 2009, http://deluxepopupwindow.com -->
</head>
<body bgcolor="#FFFFFF">
<script type="text/javascript" src="deluxe-popup-window.js"></script>
<script type="text/javascript" src="deluxe-popup-window2.js"></script>
</body>