JavaScript - Graphical, Expanding Vertical Menu
Hi All,
My apologies if this is answered in a previous post but my searches didn't turn up a solution. I need an expanding, vertical menu, virtually identical to: http://www.dynamicdrive.com/dynamici...enu-glossy.htm but with one change. The menu subheaders, ie, "CSS Examples, CSS Drives" are currently just text and their background is defined in the CSS. I need to make these menu subheaders rollover graphics instead of text. It is easy to replace the submenu items themselves with rollover graphics instead of text, but the menu subheaders have defeated me. Is there a cunning solution to this? Regards Gary Similar TutorialsI'm creating a menu using html, css and a javascript, I found a tutorial to follow online. What I am trying to achieve is when the mouse hovers over the menu items, each item will have a different colour background. the problem is that i can do this but it only works with one colour and not different colours. this is the html: Code: <ul> <li><a href="1.php">Things</a></li> <li><a href="2.php">Animals</a> <ul> <li><a href="2-1.php">Cani</a> <ul> <li><a href="2-1-1.php">Domestic dogs</a></li> <li><a href="2-1-2.php">Wolves</a></li> </ul> </li> <li><a href="2-2.php">Felidae</a> <ul> <li><a href="2-2-1.php">Domestic cats</a></li> <li><a href="2-2-2.php">Wild cats</a></li> </ul> </li> </ul> </li> <li><a href="3.php">Humans</a></li> </ul> the css is as follows: Code: div#s1 { width: 200px; /* menu width */ } div#s1 ul { background-color: #036; list-style-type: none; /* get rid of the bullets */ padding:0; /* no padding */ margin:0; /* no margin for IE either */ } div#s1 ul li { margin: 0; padding: 0; background-color: #036; display:block; border-top: 1px solid white; /* lines */ } div#s1 ul li a { display: block; /* lines extend to right, make area clickable */ color: white; background-color: #036; padding: 3px 3px 3px 23px; margin:0; text-decoration: none; height:15px; /* hint for IE, alternatively remove whitespace from HTML */ } div#s1 ul ul li a { margin-left: 20px; /* indent level 1 */ } div#s1 ul ul ul li a { margin-left: 40px; /* indent level 2 */ } div#s1 ul ul ul ul li a { margin-left: 60px; /* indent level 3 */ } div#s1 li ul, div#s1 li.open li.closed ul { display: none; /* collapse */ } div#s1 li.open ul { display: block; /* expand */ } div#s1 ul li.open a { background-image: url(bullet_open.gif); background-repeat: no-repeat; } div#s1 ul li.closed a { background-image: url(bullet_closed.gif); background-repeat: no-repeat; } div#s1 ul li.leaf a { background-image: url(bullet_leaf.gif); background-repeat: no-repeat; } div#s1 li.active a { background-position: 0px -20px; color: red; /* highlight text */ } div#s1 li.active li a { background-position: 0px 0px; color: white; /* fix lower levels */ } div#s1 ul li a:hover { color: red; background-color: #06C; /* rollover effect */ } and finally the javascript: Code: var menu_active_class = "active"; var menu_leaf_class = "leaf"; var menu_open_class = "open"; var menu_closed_class = "closed"; //the default page that is displayed if URL ends in / var menu_default_page = "index.php"; var menu_url; //main function //menu_id : id of the element containing the navigation function menu_main(menu_id) { var url = location.href; if (url.lastIndexOf("/") == (url.length-1)) { url = url+menu_default_page; } if (url.lastIndexOf("?") >= 0) { url = url.substring(0, url.lastIndexOf("?")); } if (url.lastIndexOf("#") >= 0) { url = url.substring(0, url.lastIndexOf("#")); } menu_url = url; var main = document.getElementById(menu_id); if (!main) alert("No element with id '"+ menu_id +"' found"); menu_traverse(main); } /* Walks down the subtree and on the way back sets properties. returns bit set 1: set = element is a node, unset = element is a leaf 2: set = element contains the active node 4: set = element is the active A node */ function menu_traverse(element) { var props = 0; // walk down for (var i=0; i<element.childNodes.length; i++) { var child = element.childNodes[i]; props |= menu_traverse(child); // aggregate bits } // on the way back now switch (element.tagName) { case "UL": props |= 1; break; case "LI": var c1 = (props & 1) ? ((props & (2|4)) ? menu_open_class : menu_closed_class) : menu_leaf_class; element.className = element.className ? element.className+" "+c1 : c1; if (props & 4) { if (!(props & 2)) element.className += " "+menu_active_class; props |= 2; props &= 1 | 2; // reset bit 4 } break; case "A": if (props & 2) break; // once is enough var href = element.getAttribute("href"); if (menu_isSameUrl(menu_url, href)) props |= 4; break; } return props; } //matches two URIs when href is the last part of url //.. and . are correctly resolved function menu_isSameUrl(url, href) { var a = url.split(/[?\/]/i); var b = href.split(/[?\/]/i); var i = a.length - 1; var j = b.length - 1; while ((i >= 0) && (j >= 0)) { if (b[j] == "..") { j-=2; continue; } if (a[i] == "..") { i-=2; continue; } if ((b[j] == ".") || (b[j] == "")) { j--; continue; } if ((a[i] == ".") || (a[i] == "")) { i--; continue; } if (! (a[i] == b[j])) return false; i--; j--; } return true; } New to this forum but hope this will explain my problem, any help is much appreciated! thanks!! Jesper Code: function initMenu(){ var menus, menu, text, a, i, CurrentID; menus = getChildrenByElement(document.getElementById("menu")); CurrentID = document.getElementById("auto"); for(i = 0; i < menus.length; i++){ menu = menus[i]; text = getFirstChildByText(menu); a = document.createElement("a"); menu.replaceChild(a, text); a.appendChild(text); a.href = "#"; a.onclick = showMenu; a.onfocus = function(){this.blur()}; } //CurrentID.showMenu; thought this would work but it doesn.t } I am modifying a website for a company I am interning at. I have no javascript experience and was just thrown in. I need the menu to open when page is clicked so that it looks like the menu stayed open when you made a selection and the new page loads. I have a id in the html of the pages called "auto" to designate the menu item in the page to be opened. If anyone could help I would be very grateful. I will be keeping a lookout for posts If this is in the wrong forum please move it. I'm new to Javascript so I'm not so much aware of the types as of yet. I'm using Javascript for the first time, and I've used it on my blog to create a blog archive. However, I want it to be set out like this: Menu Item 1 [Click to expand] -Sub Item 1.1 [Click to expand] -Sub Item 2.1 [Click to get to page] Menu Item 1 is expanding fine, and I know how to get Sub Item 2.1 to link to the page, however I can't seem to link Sub Item 1.1 to expand. Can someone help please? URL: http://dinotamermeep.blogspot.com/p/blog-archive.html Thank you, -Meepski Hi. I am trying to learn how to make a Javascript menu for my webpage. I have made the menu and it works. I can collapse a submenu when I click on the menu header. I wan't it to start collapsed and then open a menu item when you click on it. I have figured out that it have something to do with the function Closeall(). But can't figure out what. Perhaps someone in here can help me or perhaps help me make a better menu. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>IT-Menu</title> <script type="text/javascript" language="javascript1.3"> function closeall() { var divs=document.getElementsByTagName('div') for(var i=0; i<divs.length; i++) divs.style.display='none'; } function clicked(element) { var div=document.getElementById(element) if(div.style.display=='none') div.style.display='block'; else div.style.display='none'; return; } </script> </head> <body> <a href="#" onclick="clicked('MENU1')">MENU1</a><div id="MENU1"> <a href="#">SUBMENU1</a> <br /> <a href="#">SUBMENU2</a> </div> <br /> <a href="#" onclick="clicked('MENU2')">MENU2</a><div id="MENU2"> <a href="#">SUBMENU1</a> <br /> <a href="#">SUBMENU2</a> </div> </body> Hey, I'm having trouble with this site http://bit.ly/hL0u0w... If you go to the services section you will see a sub navigation on the left of the box. The idea of this is to have sub sections within the main headings that expand/collapse when selected. Insted when any one link is clicked the whole menu expands and not just the related sub sections. This is the javascript Quote: <script type="text/javascript"> $(document).ready (function() { $('#link1').click(function() { $('.slide').slideToggle('fast'); }); $('.close').click(function() { $('.slide').slideUp('fast'); }); $(document).ready (function() { $('#link2').click(function() { $('.slide').slideToggle('fast'); }); $('.close').click(function() { $('.slide').slideUp('fast'); }); }); $(document).ready (function() { $('#link3').click(function() { $('.slide').slideToggle('fast'); }); $('.close').click(function() { $('.slide').slideUp('fast'); }); }); }); </script> and here is the html Quote: <div id="subnav4"> <ul class="navigation4 pagination"> <li class="tab4"><a rel="1" id="link1" href="#">heading 1</a></li> <li style="display: none;" class="dome slide"><a href="#">corporate id</a></li> <li style="display: none;" class="dome slide"><a href="#">branding</a></li> <li style="display: none;" class="dome slide"><a href="#">brochures</a></li> <li style="display: none;" class="dome slide"><a href="#">direct mail</a></li> <li class="tab4"><a id="link2" href="#">heading 2</a></li> <li style="display: none;" class="dome slide"><a href="#">email marketing</a></li> <li style="display: none;" class="dome slide"><a href="#">websites</a></li> <li class="tab4"><a id="link3" href="#">heading 3</a></li> <li style="display: none;" class="dome slide"><a href="#">advertising</a></li> <li style="display: none;" class="dome slide"><a href="#">audiovisual</a></li> <li class="tab4"><a id="heading 3" href="#">exhibitions</a></li> </ul> </div> Hope someone can help with this! Many thanks! Hello all, Firstly apologies for my javascript ignorance - I'm not a programmer, just someone thrust into programming since there's no-one else at my company who can do it. I found a nice js script online for a drop-down menu where the drop downs both expand to their full size and fade-in (very quickly) from transparent. The script in action can be seen on the script writer's site he http://sandbox.leigeber.com/dropdown-menu/index.html and the script is: Code: var menu=function(){ var t=15,z=50,s=6,a; function dd(n){this.n=n; this.h=[]; this.c=[]} dd.prototype.init=function(p,c){ a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0; for(i;i<l;i++){ var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i]; h.onmouseover=new Function(this.n+'.st('+i+',true)'); h.onmouseout=new Function(this.n+'.st('+i+')'); } } dd.prototype.st=function(x,f){ var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0]; clearInterval(c.t); c.style.overflow='hidden'; if(f){ p.className+=' '+a; if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0} if(c.mh==c.offsetHeight){c.style.overflow='visible'} else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)} }else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)} } function sl(c,f){ var h=c.offsetHeight; if((h<=0&&f!=1)||(h>=c.mh&&f==1)){ if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'} clearInterval(c.t); return } var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh; c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')'; c.style.height=h+(d*f)+'px' } return{dd:dd} }(); with Code: var menu=new menu.dd("menu"); menu.init("menu","menuhover"); used on my html page to call the script. I'm using the script exactly as written and exactly as it is on the dude's demo page for it. However, some of my sub-menu items are wider than their parent items and in IE7 this means they are bound to the width of the parent until the animations have finished, and then pop-out to their full width (NB not an issue in FF3). I'm actually not too fussed about either the fade in or expand out effects (they'd be nice, but not at the expense of the IE7 bug) so I simply wanted to know what I should do to the script to turn off the effects, or make them instant - ie reduce the length of the effect to as short as possible. I understand I can get rid of the bug by specifying a width for the ul element in my css, but I'd rather not do that if I can help it. I'd appreciate anyone's insight on this. Thanks Tom Hello all, I am doing a website project and in that currently I am designing a product page. I have to design add values to text boxes and drag and drop the text boxes in the workspace and delete the text boxes the user does not want and have to draw a graphical line between the text boxes which are in order. I have designed and coded everything except the graphical line part. I am a learner in javascript and Can we draw a graphical line dynamically between the text boxes in the webpage? If we can draw, can anyone let me know the tutorial for that so that I can learn and start coding as I have to submit that project soon. Thank you. Hi, I would like to use the menu that is linked below. I implemented it on my website but I discovered that it can only go 2 levels deep. I would like it to go one more level and I think that would be done in the javascript but I can't tell for sure. Could someone steer me in the right direction? http://www.javascriptkit.com/script/...icalmenu.shtml Thanks! Rob Hello, I am currently working on a menu and have a few questions and have one issue. First: How can I set the menu to automatically expand on mouse rollover instead of click? Here is the code as it stands right now: Quote: $(document).ready(function () { $('img.menu_class').click(function () { $('ul.the_menu').slideToggle('medium'); }); }); Second Question: For some reason, the menu is appearing behind a table row when it expands, thus hiding a good portion of the menu. Here it is: http://gem-tech.com.mytempweb.com/store/pc/home.asp Try clicking on 'Products & Services', and then clicking on "Centerfire Rifle Suppressors" from the dropdown menu. When it takes you to that category page, click the menu again and you will see that the menu hides behind the <h1> table row. How can I fix this? Thank you very much Hi I need to make a vertical menu bar where the sub menu that flies out on the right always starts at the top rather than next to its parent. I used this script http://www.javascriptkit.com/script/...icalmenu.shtml at the moment lists look like this (bold is selected option) 1 2 1 3 2 4 3 1 what i want is this to happen 1 1 1 2 2 3 3 4 Alternatively, does anyone know how to get the vertical spry menubar from DW to work in Safari? To get an idea of what I want, see this working version (not working in Safari though) in Firefox http://www.photoshopcourselondon.com...0open%202.html thanks mikael If you look at this test page, you see a vertical image menu. This menu is originally from http://www.byscripts.info/scripts/ja...accordion-menu (example 3) But... how can you get it to 100% heigh? Please, look at the source code Thanks I've added a Vertical Sliding Menu to my website that only seems to work in Internet Explorer. I have no idea what to do to get it to work in other browsers. If I could at least get it work in Firefox that would be great, but as I said, I'm a bit lost on how to do that. If anyone could help me I would gladly send them a box of chocolates. The menu is made up of images that are partially recessed into the left of the page, except for a small section which remains visible. When that section is clicked the image slides all the way into view revealing more options. The links are all done with image maps, if that helps. Here is the entire Javascript code that goes into the head tag: Code: <SCRIPT LANGUAGE="JavaScript"> <!-- Beginning of JavaScript - var Abouttop=124 var Newstop=195 var Profilestop=258 var Issuestop=351 var Extrastop=423 var Linkstop=499 var Forumtop=571 var menuleft=-118 var pace=14 var step var direction var pause=25 var thismenu var vorzeichen=1 var vorzeiAbout=-1 var vorzeiNews=-1 var vorzeiProfiles=-1 var vorzeiIssues=-1 var vorzeiExtras=-1 var vorzeiLinks=-1 var vorzeiForum=-1 var menuismoving="no" function gotourl(thisurl) { alert("\n\nThis is onlay a demonstration.\nYou will not be linked to "+thisurl+".html.") } function inite() { if (document.layers) { document.About.left=menuleft document.News.left=menuleft document.Profiles.left=menuleft document.Issues.left=menuleft document.Extras.left=menuleft document.Links.left=menuleft document.Forum.left=menuleft document.About.top=Abouttop document.News.top=Newstop document.Profiles.top=Profilestop document.Issues.top=Issuestop document.Extras.top=Extrastop document.Links.top=Linkstop document.Forum.top=Forumtop } if (document.all) { document.all.About.style.posLeft=menuleft document.all.News.style.posLeft=menuleft document.all.Profiles.style.posLeft=menuleft document.all.Issues.style.posLeft=menuleft document.all.Extras.style.posLeft=menuleft document.all.Links.style.posLeft=menuleft document.all.Forum.style.posLeft=menuleft document.all.About.style.posTop=Abouttop document.all.News.style.posTop=Newstop document.all.Profiles.style.posTop=Profilestop document.all.Issues.style.posTop=Issuestop document.all.Extras.style.posTop=Extrastop document.all.Links.style.posTop=Linkstop document.all.Forum.style.posTop=Forumtop } } function getmenuname(clickedmenu) { if (menuismoving=="no") { if (document.layers) { thismenu=eval("document."+clickedmenu) } if (document.all) { thismenu=eval("document.all."+clickedmenu+".style") } step=pace checkdirection() movemenu() } } function checkdirection() { if (document.layers) { if (thismenu==document.About){vorzeiAbout=vorzeiAbout*-1;vorzeichen=vorzeiAbout} if (thismenu==document.News){vorzeiNews=vorzeiNews*-1;vorzeichen=vorzeiNews} if (thismenu==document.Profiles){vorzeiProfiles=vorzeiProfiles*-1;vorzeichen=vorzeiProfiles} if (thismenu==document.Issues){vorzeiIssues=vorzeiIssues*-1;vorzeichen=vorzeiIssues} if (thismenu==document.Extras){vorzeiExtras=vorzeiExtras*-1;vorzeichen=vorzeiExtras} if (thismenu==document.Links){vorzeiLinks=vorzeiLinks*-1;vorzeichen=vorzeiLinks} if (thismenu==document.Forum){vorzeiForum=vorzeiForum*-1;vorzeichen=vorzeiForum} } if (document.all) { if (thismenu==document.all.About.style){vorzeiAbout=vorzeiAbout*-1;vorzeichen=vorzeiAbout} if (thismenu==document.all.News.style){vorzeiNews=vorzeiNews*-1;vorzeichen=vorzeiNews} if (thismenu==document.all.Profiles.style){vorzeiProfiles=vorzeiProfiles*-1;vorzeichen=vorzeiProfiles} if (thismenu==document.all.Issues.style){vorzeiIssues=vorzeiIssues*-1;vorzeichen=vorzeiIssues} if (thismenu==document.all.Extras.style){vorzeiExtras=vorzeiExtras*-1;vorzeichen=vorzeiExtras} if (thismenu==document.all.Links.style){vorzeiLinks=vorzeiLinks*-1;vorzeichen=vorzeiLinks} if (thismenu==document.all.Forum.style){vorzeiForum=vorzeiForum*-1;vorzeichen=vorzeiForum} } menuismoving="yes" } function movemenu() { if (document.layers) { if (step>=0) { thismenu.left+=step*vorzeichen step-- var movetimer=setTimeout("movemenu()",pause) } else { menuismoving="no" clearTimeout(movetimer) } } if (document.all) { if (step>=0) { thismenu.posLeft+=step*vorzeichen step-- var movetimer=setTimeout("movemenu()",pause) } else { menuismoving="no" clearTimeout(movetimer) } } } // - End of JavaScript - --> </SCRIPT> Code: This is the CSS code that also goes into the head tag: <style type="text/css"> #About {position:absolute;left:-1000px;} #News {position:absolute;left:-1000px;} #Profiles {position:absolute;left:-1000px;} #Issues {position:absolute;left:-1000px;} #Extras {position:absolute;left:-1000px;} #Links {position:absolute;left:-1000px;} #Forum {position:absolute;left:-1000px;} .baseline { position:absolute; left:250px; top:100px; font-family:Arial; font-size:9pt; color:000000; } </STYLE> And I'm not sure if this is needed or not, but just in case, here is everything between the body tags Code: <body onLoad="inite()" topmargin="0" leftmargin="0"> <DIV ID="About"> <IMG SRC="images/main/menu_tab_about2.gif" USEMAP="#Aboutdec99.gif" WIDTH=150 HEIGHT=71 BORDER=0> <MAP NAME="Aboutdec99.gif"> <AREA SHAPE=RECT COORDS="128,3,143,67" HREF="javascript:getmenuname('About')"> <AREA SHAPE=RECT COORDS="30,4,113,20" HREF="about_nw.asp"> <AREA SHAPE=RECT COORDS="88,21,113,34" HREF="siteinfo.asp"> <AREA SHAPE=RECT COORDS="35,35,113,51" HREF="contributions.asp"> <AREA SHAPE=RECT COORDS="65,52,113,66" HREF="contact.asp"> </MAP></DIV> <DIV ID="News"><IMG SRC="images/main/menu_tab_news2.gif" USEMAP="#Newsdec99.gif" WIDTH=150 HEIGHT=63 BORDER=0> <MAP NAME="Newsdec99.gif"> <AREA SHAPE=RECT COORDS="128,5,143,58" HREF="javascript:getmenuname('News')"> <AREA SHAPE=RECT COORDS="30,14,113,31" HREF="news.asp"> <AREA SHAPE=RECT COORDS="30,33,113,48" HREF="news_archive.asp"> </MAP></DIV> <DIV ID="Profiles"><IMG SRC="images/main/menu_tab_profiles2.gif" USEMAP="#Profilesdec99.gif" WIDTH=150 HEIGHT=93 BORDER=0> <MAP NAME="Profilesdec99.gif"> <AREA SHAPE=RECT COORDS="128,5,143,89" HREF="javascript:getmenuname('Profiles')"> <AREA SHAPE=RECT COORDS="26,11,113,26" HREF="char_current.asp"> <AREA SHAPE=RECT COORDS="66,30,113,46" HREF="char_inactive.asp"> <AREA SHAPE=RECT COORDS="65,48,113,66" HREF="char_villains.asp"> <AREA SHAPE=RECT COORDS="90,68,113,82" HREF="char_all.asp"> </MAP></DIV> <DIV ID="Issues"><IMG SRC="images/main/menu_tab_issues2.gif" USEMAP="#Issuesdec99.gif" WIDTH=150 HEIGHT=72 BORDER=0> <MAP NAME="Issuesdec99.gif"> <AREA SHAPE=RECT COORDS="128,5,143,67" HREF="javascript:getmenuname('Issues')"> <AREA SHAPE=RECT COORDS="53,9,113,25" HREF="issues_uc.asp"> <AREA SHAPE=RECT COORDS="30,28,113,43" HREF="issues.asp"> <AREA SHAPE=RECT COORDS="52,48,113,63" HREF="issues_past.asp"> </MAP></DIV> <DIV ID="Extras"><IMG SRC="images/main/menu_tab_extra2.gif" USEMAP="#Extrasdec99.gif" WIDTH=150 HEIGHT=76 BORDER=0> <MAP NAME="Extrasdec99.gif"> <AREA SHAPE=RECT COORDS="128,6,143,71" HREF="javascript:getmenuname('Extras')"> <AREA SHAPE=RECT COORDS="47,10,113,27" HREF="wallpapers.asp"> <AREA SHAPE=RECT COORDS="65,29,113,45" HREF="avatars.asp"> <AREA SHAPE=RECT COORDS="36,48,113,64" HREF="merch.asp"> </MAP></DIV> <DIV ID="Links"><IMG SRC="images/main/menu_tab_links2.gif" USEMAP="#Linksdec99.gif" WIDTH=150 HEIGHT=72 BORDER=0> <MAP NAME="Linksdec99.gif"> <AREA SHAPE=RECT COORDS="128,10,143,64" HREF="javascript:getmenuname('Links')"> <AREA SHAPE=RECT COORDS="13,5,113,19" HREF="http://www.newwarriors.com"> <AREA SHAPE=RECT COORDS="74,21,113,34" HREF="http://newwarriors.wordpress.com" alt="New Warriors Continuity Conundrum"> <AREA SHAPE=RECT COORDS="32,37,113,51" HREF="http://infinitytitans.anycities.com/warriorsmix.html"> <AREA SHAPE=RECT COORDS="19,53,113,67" HREF="http://www.novaprimepage.com"> </MAP></DIV> <DIV ID="Forum"><IMG SRC="images/main/menu_tab_forum2.gif" usemap="#menu_tab_test.jpg" width="150" height="69" border=0> <map name="menu_tab_test.jpg"> <AREA shape=rect COORDS="128,5,143,66" HREF="http://www.newwarriors.net/forum"> </map></DIV> </body> And in case anyone wants to see what I'm talking about, here is the link to the page so that you can see the menu bar and how it functions. Make sure you are viewing it in IE though. lol. http://www.newwarriors.net I hope that's all of the information that is needed. I just don't have a clue what to do. I really like the menu and want to keep it. Thanks so much! Hi... I did the Cut & Paste CSS Vertical List Menu, but I have an issue with submenus... Appear behind other divs. I attach a print screen. I include inside a div. Any idea? Code: <div id="sidebar1"> <ul id="verticalmenu" class="glossymenu"> <li><a href="http://www.javascriptkit.com/">JavaScript Kit</a></li> <li><a href="http://www.javascriptkit.com/cutpastejava.shtml" >Free JavaScripts</a></li> <li><a href="http://www.javascriptkit.com/">JavaScript Tutorials</a></li> <li><a href="#">References</a> <ul> <li><a href="http://www.javascriptkit.com/jsref/">JavaScript Reference</a></li> <li><a href="http://www.javascriptkit.com/domref/">DOM Reference</a></li> <li><a href="http://www.javascriptkit.com/dhtmltutors/cssreference.shtml">CSS Reference</a></li> </ul> </li> <li><a href="http://www.javascriptkit.com/cutpastejava.shtml" >DHTML/ CSS Tutorials</a></li> <li><a href="http://www.javascriptkit.com/howto/">web Design Tutorials</a></li> <li><a href="#" >Helpful Resources</a> <ul> <li><a href="http://www.dynamicdrive.com">Dynamic HTML</a></li> <li><a href="http://www.codingforums.com">Coding Forums</a></li> <li><a href="http://www.cssdrive.com">CSS Drive</a></li> <li><a href="http://www.dynamicdrive.com/style/">CSS Library</a></li> <li><a href="http://tools.dynamicdrive.com/imageoptimizer/">Image Optimizer</a></li> <li><a href="http://tools.dynamicdrive.com/favicon/">Favicon Generator</a></li> </ul> </li> </ul> </div> Hi, I am trying to do a FAQ section on a site. New to this stuff. What I would like to do is: 1.Question 2.Answer (Question and part of an answer are visible) 3. A button for expanding/collapsing. I am trying to do a button that changes on hover,and when text is expanded image changes, then on hover it changes again and if I press I collapse it to the original image). What I got so far is this: Code: <head> <style type="text/css"> .divVisible {display:block;} .divHidden {display:none;} #test {background-color: red;} </style> <script language="javascript" type="text/javascript"> var divID = "MyDiv"; function CollapseExpand() { var divObject = document.getElementById(divID); var currentCssClass = divObject.className; if (divObject.className == "divVisible") divObject.className = "divHidden"; else divObject.className = "divVisible"; } function changeImage() { document.images["Button1"].src= "less.png"; return true; } function changeImageBack() { document.images["Button1"].src = "more.png"; return true; } </script> </head> <body> <div id="test"> <div> TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST </div> <div id="MyDiv" class="divHidden"> - TEST TEST TEST TEST - TEST TEST TEST TEST - TEST TEST TEST TEST - TEST TEST TEST TEST - TEST TEST TEST TEST </div> </div> <A href="#" onMouseOver="return changeImage()" onMouseOut= "return changeImageBack()" input id="Button1" type="button" onClick="return CollapseExpand()" ><img name="Button1" src="less.png" width="81" height="42" border="0" alt="javascript button"></A> </body> </html> I tried different stuff but couldn't connect 4 images. (more.png, morehover.png, less.png, lesshover.png). Thnx in advance G. Can anyone show me the code for a simple expanding navigation bar? I need to roll over the nav bar and for it to drop down with more options. I know the code will be straight forward, I can't work it out though. Thanks whoever can help = ) Hello, I created a page which has 12 collapsible panels, each can be opened and closed independently but i would like to have one button on the page that expands all the content, for printability. Below is the section of javascript that relates to the original state of the collapsible panel. When I change the this.contentIsOpen to be true all the panels expand. I would like a way of linking this function to a button. Code: Spry.Widget.CollapsiblePanel.prototype.init = function(element) { this.element = this.getElement(element); this.focusElement = null; this.hoverClass = "CollapsiblePanelTabHover"; this.openClass = "CollapsiblePanelOpen"; this.closedClass = "CollapsiblePanelClosed"; this.focusedClass = "CollapsiblePanelFocused"; this.enableAnimation = true; this.enableKeyboardNavigation = true; this.animator = null; this.hasFocus = false; this.contentIsOpen = false; }; Many thanks Liam Hi all, I am looking to create this in JS/DHTML/CSS that I found in a flash script you can view he http://www.melodicmedia.com/dev/expa...ash_flash.html I want the red expanding and contracting circle to be on top of a image so it only shows the parts of the image that the circle is around. Any help you have would be much appreciated =) Thank you =) Light and Love and Healing to you, -Patrick Arden McNally Hey everyone, I'm a little new to JS coding but I am trying to design a simple system that I hope you can help me with. Basically, I want to know which is the best approach to this problem, or a direction where I can find info about it. The web application I designed uses basic PHP with basic JS and very basic Ajax which populates some divs with MySQL data. I went with a more "Web 2.0" approach instead of having a page for everything; I wanted to create dynamic pages. That's the gist of how the site works... OK. The issue is I have a table that is populated via a PHP script pulling from a MySQL database. This works fine. What I need is a way (via some clickable region on each <tr> element maybe?) to expand each table "row" to show a form to do some database updates. I don't need the full CRUD, just Read/Update and I am trying to write it as simple as possible. I do not need help on the form, I just need a direction or suggestion on how to accomplish the act of displaying the form, or call it the "expanding rows which reveal a web form for database interaction". I have seen some nice Ajax ways, but I am only a beginner when it comes to those techniques and am not in the habit of taking work from other people and using it on something I am creating (and I learn more this way too; the whole "teach a man to fish vs. give a man a fish") Option#1: What I was thinking was a way to "hide" the form which could already exist on every row, but then "show" it via an expand function? Option#2: Or maybe a generic hidden div that has the form on it, placed on the next row down when clicked,.. but then how would the form know which row to edit via MySQL? I think option 1 sounds better..... Again, I need help on making this form pop up on each table row. Any help or direction would be greatly appreciated. Sample code follows: Code: <table> <thead> <tr> <th>ID</th> <th>Name</th> <th>Number</th> <th>Address</th> <th>Email</th> <th>Alt Number</th> </tr> </thead> <tbody> //<!--Some PHP code that populates all table rows, every row is a row in the database like below-->// <tr> <td onclick="javascriptfunction(this)">foo</td> <td>bar</td> <td>data</td> <td>from</td> <td>MySQL</td> <td>Database</td> </tr> <div id="PopUpForm"> <form id="form_id" name="form_name" action="foo.php" method="post"> <input type="hidden" name="id" value="//<!--Value of MySQL ID-->//"/> <table title="myTable" style="margin: auto; display:hidden"> <tr class ="theader2"><th colspan="2">TEST TABLE</th> </tr> <tr> <td class="header">Some Field: </td> <td class="selector"><select name="foo" style="width: 150px;" id="foo"> <option value="" selected="selected">-- Select Value --</option> <tr> <input type="submit" value="Submit" class="btn"/> </form> </div> //<!--Some PHP code ends here-->// </tbody> Any help would be greatly appreciated =) Hi all, I'm using the scripts from Dynamic Drive http://www.dynamicdrive.com/dynamici...edcollapse.htm to create a sliding collapsing/expanding div. I need to modify it slightly so instead of an image for the toggle, it has text hyperlink - changing from "Show More" to "Show Fewer". Can anyone help? Thanks http://www.mainstudio.com/ Can anyone recommend a code to create an expandable panel similar the one in this link, but one which expands and collapses horizontally as opposed to vertically? Also, to include the functionality of having content inside each panel load only after its clicked. |