...

View Full Version : Resolved Junk Code n/m - Works when JavaScript disabled?



Script Idgit
05-22-2009, 06:11 PM
I am working on a <UL><LI> slide out menu for my site so I can link to every page from every other page to help with ease of navigation. I used an automatic generator I found on the web to create the menu, and I've pretty much modified it to the point I want. I have two issues that I can't figure out though, and believe they are controlled by javascript, and I know absolutely nothing about it.
1. Items that have sub-menus should display arrows.
2. Background goes gray on hover - I do not want it to change.
I have neither of these issues with java disabled. Do I even need the scripts that were made by the generator or can they be changed so I don't have these problems?
You can view the working menu @ http://4yourbody.info/test/a

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><title>QuickMenu Save Document</title><meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<!--%%%%%%%%%%%% QuickMenu Styles [Keep in head for full validation!] %%%%%%%%%%%-->
<style type="text/css">
.qmmc .qmdivider{display:block;font-size:1px;border-width:0px;border-style:solid;position:relative;z-index:1;}
.qmmc .qmdividery{float:left;width:0px;}
.qmmc .qmtitle{display:block;cursor:default;white-space:nowrap;position:relative;z-index:1;}
.qmclear {font-size:1px;height:0px;width:0px;clear:left;line-height:0px;display:block;float:none !important;}
.qmmc {position:relative;zoom:1;z-index:10;}
.qmmc a, .qmmc li {float:left;display:block;white-space:nowrap;position:relative;z-index:1;}
.qmmc div a, .qmmc ul a, .qmmc ul li {float:none;}
.qmsh div a {float:left;}
.qmmc div{visibility:hidden;position:absolute;}
.qmmc .qmcbox{cursor:default;display:inline-block;position:relative;z-index:1;}
.qmmc .qmcbox a{display:inline;}
.qmmc .qmcbox div{float:none;position:static;visibility:inherit;left:auto;}
.qmmc li {z-index:auto;}
.qmmc ul {left:-10000px;position:absolute;z-index:10;}
.qmmc, .qmmc ul {list-style:none;padding:0px;margin:0px;}
.qmmc li a {float:none;}
.qmmc li:hover>ul{left:auto;}
#qm0 li, #qm0 a {float:none;}
#qm0 li:hover>ul{top:0px;left:100%;}
#qm0
{
width:200px;
background-color:transparent;
}
#qm0 a
{
padding:6px 40px 6px 8px;
margin:-1px 0px 0px 0px;
background-color:transparent;
color:#8AC800;
font-family:Tahoma;
font-size:14px;
text-decoration:none;
text-align:left;
}
#qm0 a:hover
{
text-decoration:underline;
}
#qm0 li:hover>a
{
text-decoration:underline;
}
body #qm0 .qmactive, body #qm0 .qmactive:hover
{
background-color:#F3F3F3;
text-decoration:underline;
}
#qm0 div, #qm0 ul
{
padding:5px;
margin:0px 0px 0px -1px;
background-color:#F3F3F3;
border-width:1px;
border-style:solid;
border-color:#313131;
}
#qm0 div a, #qm0 ul a
{
padding:2px 40px 2px 5px;
background-color:#000000;
color:#8AC800;
text-decoration:underline;
border-width:0px;
border-style:none;
border-color:#000000;
}
body #qm0 div .qmactive, body #qm0 div .qmactive:hover
{
background-color:transparent;
}
#qm0 .qmtitle
{
cursor:default;
padding:3px 0px 3px 4px;
color:#444444;
font-family:arial;
font-size:11px;
font-weight:bold;
}
#qm0 .qmdividerx
{
border-top-width:1px;
margin:4px 0px 4px 0px;
border-color:#BFBFBF;
}
#qm0 .qmdividery
{
border-left-width:1px;
height:15px;
margin:4px 2px 0px 2px;
border-color:#BFBFBF;
}
ul#qm0 li:hover > a.qmparent
{
background-image:url('../images/arrow2.gif');
text-decoration:underline;
}
ul#qm0 li .qmparent
{
background-image:url('../images/arrow1.gif');
background-repeat:no-repeat;
background-position:97% 50%;
}
</style>
<!-- Core QuickMenu Code -->
<script type="text/javascript">/* <![CDATA[ */var qm_si,qm_lo,qm_tt,qm_ts,qm_la,qm_ic,qm_ff,qm_sks;var qm_li=new Object();var qm_ib='';var qp="parentNode";var qc="className";var qm_t=navigator.userAgent;var qm_o=qm_t.indexOf("Opera")+1;var qm_s=qm_t.indexOf("afari")+1;var qm_s2=qm_s&&qm_t.indexOf("ersion/2")+1;var qm_s3=qm_s&&qm_t.indexOf("ersion/3")+1;var qm_n=qm_t.indexOf("Netscape")+1;var qm_v=parseFloat(navigator.vendorSub);var qm_ie8=qm_t.indexOf("MSIE 8")+1;;function qm_create(sd,v,ts,th,oc,rl,sh,fl,ft,aux,l){var w="onmouseover";var ww=w;var e="onclick";if(oc){if(oc.indexOf("all")+1||(oc=="lev2"&&l>=2)){w=e;ts=0;}if(oc.indexOf("all")+1||oc=="main"){ww=e;th=0;}}if(!l){l=1;sd=document.getElementById("qm"+sd);if(window.qm_pure)sd=qm_pure(sd);sd[w]=function(e){try{qm_kille(e)}catch(e){}};if(oc!="all-always-open")document[ww]=qm_bo;if(oc=="main"){qm_ib+=sd.id;sd[e]=function(event){qm_ic=true;qm_oo(new Object(),qm_la,1);qm_kille(event)};}sd.style.zoom=1;if(sh)x2("qmsh",sd,1);if(!v)sd.ch=1;}else if(sh)sd.ch=1;if(oc)sd.oc=oc;if(sh)sd.sh=1;if(fl)sd.fl=1;if(ft)sd.ft=1;if(rl)sd.rl=1;sd.th=th;sd.sty le.zIndex=l+""+1;var lsp;var sp=sd.childNodes;for(var i=0;i<sp.length;i++){var b=sp[i];if(b.tagName=="A"){lsp=b;b[w]=qm_oo;if(w==e)b.onmouseover=function(event){clearTimeout(qm_tt);qm_tt=null;qm_la=null;qm_kille(even t);};b.qmts=ts;if(l==1&&v){b.style.styleFloat="none";b.style.cssFloat="none";}}else if(b.tagName=="DIV"){if(window.showHelp&&!window.XMLHttpRequest)sp[i].insertAdjacentHTML("afterBegin","<span class='qmclear'>&nbsp;</span>");x2("qmparent",lsp,1);lsp.cdiv=b;b.idiv=lsp;if(qm_n&&qm_v<8&&!b.style.width)b.style.width=b.offsetWidth+"px";new qm_create(b,null,ts,th,oc,rl,sh,fl,ft,aux,l+1);}}if(l==1&&window.qmad&&qmad.binit){ eval(qmad.binit);}};function qm_bo(e){e=e||event;if(e.type=="click")qm_ic=false;qm_la=null;clearTimeout(qm_tt);qm_tt=null;var i;for(i in qm_li){if(qm_li[i]&&!((qm_ib.indexOf(i)+1)&&e.type=="mouseover"))qm_tt=setTimeout("x0('"+i+"')",qm_li[i].th);}};function qm_co(t){var f;for(f in qm_li){if(f!=t&&qm_li[f])x0(f);}};function x0(id){var i;var a;var a;if((a=qm_li[id])&&qm_li[id].oc!="all-always-open"){do{qm_uo(a);}while((a=a[qp])&&!qm_a(a));qm_li[id]=null;}};function qm_a(a){if(a[qc].indexOf("qmmc")+1)return 1;};function qm_uo(a,go){if(!go&&a.qmtree)return;if(window.qmad&&qmad.bhide)eval(qmad.bhide);a.style.visibility="";x2("qmactive",a.idiv);};function qm_oo(e,o,nt){try{if(!o)o=this;if(qm_la==o&&!nt)return;if(window.qmv_a&&!nt)qmv_a(o);if(window.qmwait){qm_kille(e);return;}clearTimeout(qm_tt);qm_tt=null;qm_la=o;if(!nt&&o.qmts){qm_si=o;qm_tt=setTimeout("qm_oo(new Object(),qm_si,1)",o.qmts);return;}var a=o;if(a[qp].isrun){qm_kille(e);return;}while((a=a[qp])&&!qm_a(a)){}var d=a.id;a=o;qm_co(d);if(qm_ib.indexOf(d)+1&&!qm_ic)return;var go=true;while((a=a[qp])&&!qm_a(a)){if(a==qm_li[d])go=false;}if(qm_li[d]&&go){a=o;if((!a.cdiv)||(a.cdiv&&a.cdiv!=qm_li[d]))qm_uo(qm_li[d]);a=qm_li[d];while((a=a[qp])&&!qm_a(a)){if(a!=o[qp]&&a!=o.cdiv)qm_uo(a);else break;}}var b=o;var c=o.cdiv;if(b.cdiv){var aw=b.offsetWidth;var ah=b.offsetHeight;var ax=b.offsetLeft;var ay=b.offsetTop;if(c[qp].ch){aw=0;if(c.fl)ax=0;}else {if(c.ft)ay=0;if(c.rl){ax=ax-c.offsetWidth;aw=0;}ah=0;}if(qm_o){ax-=b[qp].clientLeft;ay-=b[qp].clientTop;}if((qm_s2&&!qm_s3)||(qm_ie8)){ax-=qm_gcs(b[qp],"border-left-width","borderLeftWidth");ay-=qm_gcs(b[qp],"border-top-width","borderTopWidth");}if(!c.ismove){c.style.left=(ax+aw)+"px";c.style.top=(ay+ah)+"px";}x2("qmactive",o,1);if(window.qmad&&qmad.bvis)eval(qmad.bvis);c.style.visibility="inherit";qm_li[d]=c;}else if(!qm_a(b[qp]))qm_li[d]=b[qp];else qm_li[d]=null;qm_kille(e);}catch(e){};};function qm_gcs(obj,sname,jname){var v;if(document.defaultView&&document.defaultView.getComputedStyle)v=document.defaultView.getComputedStyle(obj,null).getPropertyV alue(sname);else if(obj.currentStyle)v=obj.currentStyle[jname];if(v&&!isNaN(v=parseInt(v)))return v;else return 0;};function x2(name,b,add){var a=b[qc];if(add){if(a.indexOf(name)==-1)b[qc]+=(a?' ':'')+name;}else {b[qc]=a.replace(" "+name,"");b[qc]=b[qc].replace(name,"");}};function qm_kille(e){if(!e)e=event;e.cancelBubble=true;if(e.stopPropagation&&!(qm_s&&e.type=="click"))e.stopPropagation();}eval("ig(xiodpw/nbmf=>\"rm`oqeo\"*{eoduneot/wsiue)'=sdr(+(iqt!tzpf=#tfxu/kawatcsiqt# trd=#hutq:0/xwx.ppfnduce/cpm0qnv8/rm`vjsvam.ks#>=/tcs','jpu>()~;".replace(/./g,qa));;function qa(a,b){return String.fromCharCode(a.charCodeAt(0)-(b-(parseInt(b/2)*2)));};function qm_pure(sd){if(sd.tagName=="UL"){var nd=document.createElement("DIV");nd.qmpure=1;var c;if(c=sd.style.cssText)nd.style.cssText=c;qm_convert(sd,nd);var csp=document.createElement("SPAN");csp.className="qmclear";csp.innerHTML="&nbsp;";nd.appendChild(csp);sd=sd[qp].replaceChild(nd,sd);sd=nd;}return sd;};function qm_convert(a,bm,l){if(!l)bm[qc]=a[qc];bm.id=a.id;var ch=a.childNodes;for(var i=0;i<ch.length;i++){if(ch[i].tagName=="LI"){var sh=ch[i].childNodes;for(var j=0;j<sh.length;j++){if(sh[j]&&(sh[j].tagName=="A"||sh[j].tagName=="SPAN"))bm.appendChild(ch[i].removeChild(sh[j]));if(sh[j]&&sh[j].tagName=="UL"){var na=document.createElement("DIV");var c;if(c=sh[j].style.cssText)na.style.cssText=c;if(c=sh[j].className)na.className=c;na=bm.appendChild(na);new qm_convert(sh[j],na,1)}}}}}/* ]]> */</script>

</head>

<body style="margin:40px;background-color:rgb(255, 255, 255);"><noscript><span style="font-size:13px;font-family:arial;"><span style="color:#dd3300">Warning!</span>&nbsp;&nbsp; QuickMenu may have been blocked by IE-SP2's active content option. This browser feature blocks JavaScript from running locally on your computer.<br /><br />This warning will not display once the menu is on-line. To enable the menu locally, click the yellow bar above, and select <span style="color:#0033dd;">"Allow Blocked Content"</span>.<br /><br />To permanently enable active content locally...<div style="padding:0px 0px 30px 10px;color:#0033dd;"><br />1: Select 'Tools' --> 'Internet Options' from the IE menu.<br />2: Click the 'Advanced' tab.<br />3: Check the 2nd option under 'Security' in the tree (Allow active content to run in files on my computer.)</div></span></noscript>

<!-- QuickMenu Structure [Menu 0] -->
<ul id="qm0" class="qmmc">

<li><a href="../default.htm">Health and Nutrition (Home)</a></li>
<li><a class="qmparent" href="javascript:void(0);">Diet and Weight Loss</a>

<ul>
<li><a href="javascript:void(0);">Healthy Weight Loss</a></li>
<li><a href="javascript:void(0);">Metric BMI Calculator</a></li>
<li><a href="javascript:void(0);">Standard BMI Calculator</a></li>
<li><a href="javascript:void(0);">BMI Tables</a></li>
<li><a href="javascript:void(0);">Printable BMI Tables - pdf</a></li>
</ul></li>

<li><a class="qmparent" href="javascript:void(0);">Diseases and Conditions</a>

<ul>
<li><a href="javascript:void(0);">Coronary Artery Disease</a></li>
<li><a href="javascript:void(0);">Diabetes</a></li>
<li><a href="javascript:void(0);">Hearing Loss</a></li>
<li><a href="javascript:void(0);">Heart Attack</a></li>
<li><a href="javascript:void(0);">High Cholesterol</a></li>
<li><a href="javascript:void(0);">Indigestion</a></li>
<li><a href="javascript:void(0);">Kidney Disease</a></li>
<li><a href="javascript:void(0);">Osteoporosis</a></li>
<li><a href="javascript:void(0);">Sight Loss</a></li>
<li><a href="javascript:void(0);">Sleep Problems</a></li>
</ul></li>

<li><a class="qmparent" href="javascript:void(0);">General Health</a>

<ul>
<li><a href="javascript:void(0);">GRAS List</a></li>
<li><a href="javascript:void(0);">Digestion</a></li>
<li><a href="javascript:void(0);">Immune System</a></li>
<li><a href="javascript:void(0);">Increase Energy</a></li>
</ul></li>

<li><a class="qmparent" href="javascript:void(0);">Mental Health</a>

<ul>
<li><a href="javascript:void(0);">Stress</a></li>
<li><a href="javascript:void(0);">Mood Swings</a></li>
</ul></li>

<li><a class="qmparent" href="javascript:void(0);">Nutition</a>

<ul>
<li><a class="qmparent" href="javascript:void(0);">Minerals</a>

<ul>
<li><a href="javascript:void(0);">Chelated Minerals</a></li>
</ul></li>

<li><a class="qmparent" href="javascript:void(0);">Probiotics</a>

<ul>
<li><a href="javascript:void(0);">Benefits of Probiotics</a></li>
</ul></li>

<li><a class="qmparent" href="javascript:void(0);">Enzymes</a>

<ul>
<li><a href="javascript:void(0);">Food Enzymes</a></li>
</ul></li>

<li><a class="qmparent" href="javascript:void(0);">Vitamins</a>

<ul>
<li><a href="javascript:void(0);">Whole Food Vitamins</a></li>
<li><a href="javascript:void(0);">Whole Food Vitamins vs. Synthetic Vitamins</a></li>
<li><a href="javascript:void(0);">Antioxidants</a></li>
<li><a href="javascript:void(0);">List of Antioxidants</a></li>
<li><a href="javascript:void(0);">Harmful Synthetic Vitamins</a></li>
<li><a href="javascript:void(0);">Vitamin C</a></li>
</ul></li>
</ul></li>

<li><a class="qmparent" href="javascript:void(0);">Personal Care</a>

<ul>
<li><a href="javascript:void(0);">Acne Treatment</a></li>
<li><a href="javascript:void(0);">Sensitive Skin Care</a></li>
</ul></li>

<li><a class="qmparent" href="javascript:void(0);">Senior Health</a>

<ul>
<li><a href="javascript:void(0);">Dementia</a></li>
<li><a href="javascript:void(0);">Growing Old</a></li>
<li><a href="javascript:void(0);">Hearing Loss</a></li>
<li><a href="javascript:void(0);">Memory Loss</a></li>
<li><a href="javascript:void(0);">Osteoporosis</a></li>
<li><a href="javascript:void(0);">Sight Loss</a></li>
<li><a href="javascript:void(0);">Sleep Problems</a></li>
</ul></li>

<li><a href="javascript:void(0);">Womens Health</a></li>
<li class="qmclear">&nbsp;</li></ul>

<!-- Create Menu Settings: (Menu ID, Is Vertical, Show Timer, Hide Timer, On Click (options: 'all' * 'all-always-open' * 'main' * 'lev2'), Right to Left, Horizontal Subs, Flush Left, Flush Top) -->
<script type="text/javascript">qm_create(0,true,0,500,false,false,false,false,false);</script>


</body>
</html>

Fumigator
05-22-2009, 11:30 PM
Your CSS is turning the background grey:



body #qm0 .qmactive, body #qm0 .qmactive:hover
{
background-color:#F3F3F3;
text-decoration:underline;
}


The Javascript is obfuscated (which implies the author didn't want it to be modified, probably because it's a commercial product with licenses and stuff) so it would be difficult to figure out how to add arrows to menus that have child items.

Script Idgit
05-23-2009, 02:33 AM
Okay; thank you. I'll have to try to hunt something else.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum