By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,136 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,136 IT Pros & Developers. It's quick & easy.

Query regarding Collapsible menu

P: 50

I am facing a problem for the allignment of the submenus under same line with the menu. Actually after clicking the menus the submenus should come exactly under same line with the menu but it is coming with some space.Can anyone help me in this regard. I am giving the total html code below which contains the javascript too.


[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
#foldheader{cursorointer;cursor:hand ; font-weight:bold}

<script language="JavaScript1.2">

//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02)
//For full source code and more DHTML scripts, visit
//This credit MUST stay intact for use

var ns6=document.getElementById&&!document.all
var ie4=document.all

function checkcontained(e)
var iscontained=0
cur=ns6? : event.srcElement
if ("foldheader")
while (ns6&&cur.parentNode||(ie4&&cur.parentNode))
if ("foldheader"||"foldinglist")
iscontained=("foldheader")? 1 : 0
cur=ns6? cur.parentNode : cur.parentNode

if (iscontained)
var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0]
if ("none")



if (ie4||ns6)


<font face="Verdana">

<li id="foldheader">News</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="">CNN</a></li>
<li><a href="">ABC News</a></li>
<li><a href="">BBC News</a></li>

<li id="foldheader">Webmaster</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="">Dynamic Drive</a></li>
<li><a href="">JavaScript Kit</a></li>
<li><a href=""></a></li>

<li id="foldheader">Nested Example</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="">outer 1</a></li>
<li><a href="">outer 2</a></li>
<li id="foldheader">Nested</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="">nested 1</a></li>
<li><a href="">nested 2</a></li>
<li><a href="">outer 3</a></li>
<li><a href="">outer 4</a></li>


Thanks in advance.
Jan 17 '08 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
You can't use the same ID for more than one element. The ID should be unique.

For the alignment of the nested lists, just remove the padding by setting the padding property to 0px.
Jan 17 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.