Wow, javascript is horrible, I can't quite get it right, this is what I'm doing:
In the header I have this:
Code:
<div id="wrap">
<!-- logo -->
<a name="top"></a>
<div id="logo_block">
<div id="logonav"><a href="$vboptions[forumhome].php$session[sessionurl_q]" title="$vboptions[bbtitle]"></a></div>
</div>
<div id="border_block">
<div id="borderleft">
<div id="borderright">
<div id="content_main" class="bodyfill">
<!-- content table -->
$spacer_open
$_phpinclude_output
$ad_location[ad_header_end]
<!-- nav buttons bar -->
<div style="text-align:center">
<a href="#" onclick="dom_toggle.toggle('menu_display', 'menu_open_close', 'images/skins/cyclone/buttons/button_menu_open.gif', 'images/skins/cyclone/buttons/button_menu_close.gif'); return false;"><img src="images/skins/cyclone/buttons/button_menu_open.gif" class="menutoggle" id="menu_open_close" alt="" /></a>
<div class="tborder" style="padding:$stylevar[cellspacing]px; border-top-width:0px">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr align="center">
<if condition="$show['member']">
<td class="vbmenu_control"><a href="usercp.php$session[sessionurl_q]">$vbphrase[user_cp]</a></td>
</if>
<if condition="$show['registerbutton']">
<td class="vbmenu_control"><a href="register.php$session[sessionurl_q]" rel="nofollow">$vbphrase[register]</a></td>
</if>
$template_hook[navbar_buttons_left]
<td class="vbmenu_control"><a rel="help" href="faq.php$session[sessionurl_q]" accesskey="5">$vbphrase[faq]</a></td>
<if condition="$show['communitylink'] AND $show['popups']">
<td class="vbmenu_control"><a id="community" href="$show[nojs_link]#community" rel="nofollow" accesskey="6">$vbphrase[community]</a> <script type="text/javascript"> vbmenu_register("community"); </script></td>
<else />
<if condition="$show['memberslist']">
<td class="vbmenu_control"><a href="memberlist.php$session[sessionurl_q]">$vbphrase[members_list]</a></td>
</if>
<if condition="$show['quick_links_groups']">
<td class="vbmenu_control"><a href="group.php?$session[sessionurl]">$vbphrase[social_groups]</a></td>
</if>
</if>
<td class="vbmenu_control"><a href="calendar.php$session[sessionurl_q]">$vbphrase[calendar]</a></td>
<if condition="$show['popups']">
<if condition="$show['searchbuttons']">
<if condition="$show['member']">
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td>
<else />
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily" accesskey="2">$vbphrase[todays_posts]</a></td>
</if>
<td class="vbmenu_control"><a id="navbar_search" href="search.php$session[sessionurl_q]" accesskey="4" rel="nofollow">$vbphrase[search]</a> <if condition="$show['quicksearch']"><script type="text/javascript"> vbmenu_register("navbar_search"); </script></if></td>
</if>
<if condition="$show['member']">
<td class="vbmenu_control"><a id="usercptools" href="$show[nojs_link]#usercptools" accesskey="3">$vbphrase[quick_links]</a> <script type="text/javascript"> vbmenu_register("usercptools"); </script></td>
</if>
<else />
<if condition="$show['searchbuttons']">
<td class="vbmenu_control"><a href="search.php$session[sessionurl_q]" accesskey="4">$vbphrase[search]</a></td>
<if condition="$show['member']">
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td>
<else />
<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getdaily" accesskey="2">$vbphrase[todays_posts]</a></td>
</if>
</if>
<td class="vbmenu_control"><a href="forumdisplay.php?$session[sessionurl]do=markread" rel="nofollow">$vbphrase[mark_forums_read]</a></td>
<if condition="$show['member']">
<td class="vbmenu_control"><a href="#" onclick="window.open('misc.php?$session[sessionurl]do=buddylist&focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=250,height=300'); return false;">$vbphrase[open_contacts]</a></td>
</if>
</if>
$template_hook[navbar_buttons_right]
<if condition="$show['member']">
<td class="vbmenu_control"><a href="login.php?$session[sessionurl]do=logout&logouthash=$bbuserinfo[logouthash]" onclick="return log_out('$vbphrase[sure_you_want_to_log_out]')">$vbphrase[log_out]</a></td>
</if>
</tr>
</table>
</div>
</div>
<!-- / nav buttons bar -->
In the headinclude I have this:
Code:
<script type="text/javascript" src="$stylevar[imgdir_misc]/js_dom_toggle.js"></script>
In the .js file there is this:
Code:
function _dom_toggle()
{
return this;
}
_dom_toggle.prototype.objref = function(id)
{
return document.getElementById ? document.getElementById(id) : (document.all ? document.all[id] : (document.layers ? document.layers[id] : null));
}
_dom_toggle.prototype.cancel_event = function()
{
if ( window.event )
{
window.event.cancelBubble = true;
}
}
_dom_toggle.prototype.toggle = function(id, open_close_id, open_icon, close_icon)
{
var object = this.objref(id);
var icon = this.objref(open_close_id);
if ( object && object.style )
{
object.style.display = (object.style.display == 'none') ? '' : 'none';
if ( icon && icon.src )
{
icon.src = (object.style.display == 'none') ? open_icon : close_icon;
}
}
this.cancel_event();
}
// instantiate
dom_toggle = new _dom_toggle();
For the css I have this:
Code:
.menutoggle {
margin: 0;
padding: 0;
border:0px;
width: 200px;
height: 30px;
}
.menutoggle a:hover {
background: url(images/skins/cyclone/buttons/button_menu_impel.gif);
margin: 0;
padding: 0;
border:0px;
width: 200px;
height: 30px;
}
The hover effect is not working, the menu is displayed by default, the javascript isn't running when I click the menu button.
Any ideas on what I have got wrong?