Drop down menu in javascript Drop down menu in javascript
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Drop down menu in javascript

Started by nhinho, August 18, 2005, 12:17:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nhinho

J just made a drop down menu in java script (script is from www.javascriptkit.com) for coppermine width theme ANIME, it work fine only on FireFox, Mozilla and Netscape, but dońt work on IE browser, anybody has a idea what I do wrong or what I have to do to??? There is my site www.vinhtrang.of.pl
and there is code:
1. I put this code in file template.htm before tag </head>
<style type="text/css">

#csstopmenu, #csstopmenu ul{
padding: 0;
margin: 0;
list-style: none;
}

#csstopmenu li{
float: left;
position: relative;
}

#csstopmenu a{
text-decoration: none;
}

.mainitems{
border: 1px solid black;
border-left-width: 0;
background-color: #D8FE89;
}

.headerlinks a{
margin: auto 8px;
font-weight: bold;
color: black;
}

.submenus{
display: none;
width: 10em;
position: absolute;
top: 1.2em;
left: 0;
background-color: #EEFFCC;
border: 1px solid black;
}

.submenus li{
width: 100%;
}

.submenus li a{
display: block;
width: 100%;
text-indent: 3px;
}

html>body .submenus li a{ /* non IE browsers */
width: auto;
}

.submenus li a:hover{
background-color: yellow;
color: black;
}

#csstopmenu li>ul {/* non IE browsers */
top: auto;
left: auto;
}

#csstopmenu li:hover ul, li.over ul {
display: block;
}

html>body #clearmenu{ /* non IE browsers */
height: 3px;
}

</style>

<script type="text/javascript">

// CSS Top Menu- By JavaScriptKit.com (http://www.javascriptkit.com)
// Adopted from SuckerFish menu
// For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
// Please keep this credit intact

startMenu = function() {
if (document.all&&document.getElementById) {
cssmenu = document.getElementById("csstopmenu");
for (i=0; i<cssmenu.childNodes.length; i++) {
node = cssmenu.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function(){                 
this.className=this.className.replace(" over", "")
}
}
}
}
}

if (window.attachEvent)
window.attachEvent("onload", startMenu)
else
window.onload=startMenu;

</script>


2. Next a I put this code on file theme.php
// HTML template for main menu
$template_main_menu = <<<EOT

<ul id="csstopmenu">

<li class="mainitems" style="border-left-width: 1px">
<div class="headerlinks"><a href="index.php">Trang chủ</a></div>
</li>

<li class="mainitems" style="border-left-width: 1px">
<div class="headerlinks"><a href="{ALB_LIST_TGT}">Phòng tranh</a></div>
<ul class="submenus" style="width: 14em">
<li><a href="{ALB_LIST_TGT}"><img border="0" src="themes/anime/menu/18_quick.gif">{ALB_LIST_LNK}</a></li>
<li><a href="{MY_GAL_TGT}"><img border="0" src="themes/anime/menu/18_privacy.gif">{MY_GAL_LNK}</a></li>
<li><a href="{LASTUP_TGT}"><img border="0" src="themes/anime/menu/18_freelic.gif">{LASTUP_LNK}</a></li>
<li><a href="{TOPN_TGT}"><img border="0" src="themes/anime/menu/18_lic.gif">{TOPN_LNK}</a></li>
<li><a href="{TOPRATED_TGT}"><img border="0" src="themes/anime/menu/18_corporate.gif">{TOPRATED_LNK}</a></li>
<li><a href="{FAV_TGT}"><img border="0" src="themes/anime/menu/18_integration.gif">{FAV_LNK}</a></li>
<li><a href="{LASTCOM_TGT}"><img border="0" src="themes/anime/menu/18_testimonial.gif">{LASTCOM_LNK}</a></li>
</ul>
</li>


<li class="mainitems" style="border-left-width: 1px">
<div class="headerlinks"><a href="cms.php?id=1">Giới thiệu</a></div>
<ul class="submenus">
<li><a href="cms.php?id=4"><img border="0" src="themes/anime/menu/18_v.gif">về Vinh..</a></li>
<li><a href="cms.php?id=5"><img border="0" src="themes/anime/menu/18_v.gif">về Trang...</a></li>
<li><a href="cms.php?id=6"><img border="0" src="themes/anime/menu/18_purchase.gif">Phim</a></li>
<li><a href="cms.php?id=7"><img border="0" src="themes/anime/menu/18_web.gif">nhà Trai</a></li>
<li><a href="cms.php?id=8"><img border="0" src="themes/anime/menu/18_bb.gif">nhà gái</a></li>
</ul>
</li>


<li class="mainitems" style="border-left-width: 1px">
<div class="headerlinks"><a href="{ALB_LIST_TGT}">myDetails</a></div>
<ul class="submenus" style="width: 14em">
<!-- BEGIN login -->
<li><a href="{LOGIN_TGT}"><img border="0" src="themes/anime/menu/18_login.gif">{LOGIN_LNK}</a></li>
<!-- END login -->
<!-- BEGIN logout -->
<li><a href="{LOGOUT_TGT}"><img border="0" src="themes/anime/menu/18_login.gif">{LOGOUT_LNK}</a></li>
<!-- END logout -->
<!-- BEGIN register -->
<li><a href="{REGISTER_TGT}" title="{REGISTER_TITLE}"><img border="0" src="themes/anime/menu/18_reg.gif">{REGISTER_LNK}</a></li>
<!-- END register -->
<!-- BEGIN my_gallery -->
<li><a href="{MY_GAL_TGT}" title="{MY_GAL_TITLE}"><img border="0" src="themes/anime/menu/18_privacy.gif">{MY_GAL_LNK}</a></li>
<!-- END my_gallery -->
<!-- BEGIN upload_pic -->
<li><a href="{UPL_PIC_TGT}" title="{UPL_PIC_TITLE}"><img border="0" src="themes/anime/menu/18_iis.gif">{UPL_PIC_LNK}</a></li>
<!-- END upload_pic -->
<!-- BEGIN allow_memberlist -->
<li><a href="{MEMBERLIST_TGT}" title="{MEMBERLIST_TITLE}"><img border="0" src="themes/anime/menu/18_user.gif">{MEMBERLIST_LNK}</a></li>
<!-- END allow_memberlist -->
<!-- BEGIN my_profile -->
<li><a href="{MY_PROF_TGT}"><img border="0" src="themes/anime/menu/18_details.gif">{MY_PROF_LNK}</a></li>
<!-- END my_profile -->
<!-- BEGIN faq -->
<li><a href="{FAQ_TGT}" title="{FAQ_TITLE}"><img border="0" src="themes/anime/menu/18_fag.gif">{FAQ_LNK}</a></li>
<!-- END faq -->
<!-- BEGIN enter_admin_mode -->
<li><a href="{ADM_MODE_TGT}" title="{ADM_MODE_TITLE}"><img border="0" src="themes/anime/menu/18_compress.gif">{ADM_MODE_LNK}</a></li>
<!-- END enter_admin_mode -->
<!-- BEGIN leave_admin_mode -->
<li><a href="{USR_MODE_TGT}" title="{USR_MODE_TITLE}"><img border="0" src="themes/anime/menu/18_nonprofit.gif">{USR_MODE_LNK}</a></li>
<!-- END leave_admin_mode -->
</ul>
</li>


<li class="mainitems" style="border-left-width: 1px">
<div class="headerlinks"><a href="guestbook.php">Lưu bút</a></div>
<ul class="submenus">
<li><a href="guestbook.php"><img border="0" src="themes/anime/menu/18_news.gif">xem lưu bút</a></li>
<li><a href="guestbook.php?vninputmask=0"><img border="0" src="themes/anime/menu/18_version.gif">viết lưu bút</a></li>
<li><a href="guestbook.php?vnstats=0"><img border="0" src="themes/anime/menu/18_whois.gif">ai từ đâu?</a></li>
</ul>
</li>
</ul>

EOT;
// HTML template for gallery admin menu
$template_gallery_admin_menu = <<<EOT

<ul id="csstopmenu">

<li class="mainitems" style="border-left-width: 1px">
<div class="headerlinks"><a href="">Dành cho quản lý</a></div>
<ul class="submenus">
<li><a href="editpics.php?mode=upload_approval">{UPL_APP_LNK}</a></li>
<li><a href="config.php" title="">{CONFIG_LNK}</a></li>
<li><a href="albmgr.php{CATL}">{ALBUMS_LNK}</a></li>
<li><a href="catmgr.php">{CATEGORIES_LNK}</a></li>
<li><a href="usermgr.php">{USERS_LNK}</a></li>
<li><a href="groupmgr.php">{GROUPS_LNK}</a></li>
<li><a href="banning.php">{BAN_LNK}</a></li>
<li><a href="db_ecard.php">{DB_ECARD_LNK}</a></li>
<li><a href="reviewcom.php">{COMMENTS_LNK}</a></li>
<li><a href="searchnew.php">{SEARCHNEW_LNK}</a></li>
<li><a href="util.php">{UTIL_LNK}</a></li>
<li><a href="profile.php?op=edit_profile">{MY_PROF_LNK}</a></li>
<li><a href="cms_admin.php">CMS Admin</a></li>
</ul>
</li>
</ul>


EOT;


please, help me to do right, thanks a lot