...

View Full Version : Dropdown menu script works for all but 1 user; extra menu kills script; JS enabled



TwilightForever
05-02-2006, 11:56 PM
Script: Anylink Drop Down Menu

Note: I searched for this beforehand on google and in the forums, but the only thing I've seen so far is how to modify the coding.

Problem: Code does not work for one of my users.

Details:

She doesn't get a javascript error. On AOL and in Internet Explorer the menu simply does not show at all. I used the process of elimination to try and find the problem, and what it narrows down to is that any added menu after the 14th one will not work for her. If I have 14 arrays, the code works for her. The addition of the 15th one gives no results. I've checked it over and can see no descrepancies.

Her Internet Explorer is version 6. JavaScript is enabled. Operating system is Windows XP.

All other users are able to view the drop down menus in AOL, Internet Explorer, and Mozilla Firefox.

The source code for this script can be found at http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm.


<style type="text/css">
<!--
#dropmenudiv {
position : absolute;
background-color: #00202d;
border : 1px solid #7b9dbf;
font : normal 8pt Verdana;
color: #fefefe;
line-height : 18px;
padding: 0px 2px 0px 2px;
z-index : 100;
}
#dropmenudiv a {
width: 100%;
display : block;
text-indent : 3px;
padding: 0px 0px 0px 8px;
text-decoration : none;
color: #7b9dbf;
letter-spacing: 0.1;
}
#dropmenudiv a:visited {
text-decoration : none;
color: #bfdfff;
}

#dropmenudiv a:hover {
background-color : #00404d;
}
-->
</style>
<script language="JavaScript" type="text/javascript">
<!--
/***********************************************
* AnyLink Drop Down Menu- &#169; Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var menu1=new Array()
menu1[0]='<a href="http://www.mysite.com/">Home Page</a>'
menu1[1]='<a href="http://www.mysite.com/howtoplay.php">How To Play</a>'
menu1[2]='<a href="http://www.mysite.com/history.php">Mysite History</a>'
menu1[3]='<a href="http://www.mysite.com/maps/">World Maps</a>'
menu1[4]='<a href="http://www.mysite.com/library/">Mysite Library</a>'
menu1[5]='<a href="http://www.mysite.com/guidelines/">RP Guidelines</a>'
menu1[6]='<a href="http://www.mysite.com/aboutstaff.php">Mysite Staff</a>'
menu1[7]='<a href="http://www.mysite.com/deceased.php">Deceased Characters</a>'
menu1[8]='<a href="http://www.mysite.com/blacklist.php">Blacklist</a>'

var menu2=new Array()
menu2[0]='Charter (IC)'
menu2[1]='<a href="http://www.mysite.com/charter/charter.php">People\'s Charter</a>'
menu2[2]='Charter (in OOC)'
menu2[3]='<a href="http://www.mysite.com/charter/policies.php">Member Laws</a>'
menu2[4]='<a href="http://www.mysite.com/charter/land.php">Land Laws</a>'
menu2[5]='<a href="http://www.mysite.com/charter/battle.php">Battle Policies</a>'
menu2[6]='<a href="http://www.mysite.com/charter/stealing.php">Stealing</a>'
menu2[7]='<a href="http://www.mysite.com/charter/ka.php">Kidnapping</a>'
menu2[8]='<a href="http://www.mysite.com/charter/ma.php">Murdering</a>'
menu2[9]='<a href="http://www.mysite.com/charter/arson.php">Destruction Laws</a>'
menu2[10]='<a href="http://www.mysite.com/charter/war.php">Warfare Laws</a>'

var menu3=new Array()
menu3[0]='<a href="http://www.mysite.com/apply.php">Join a Group</a>'
menu3[1]='<a href="http://www.mysite.com/create.php">Create New Group</a>'

var menu4=new Array()
menu4[0]='<a href="http://www.mysite.com/residents.php">Registered Groups</a>'
menu4[1]='<a href="http://www.mysite.com/charter/grouplaws.php">Group Laws</a>'
menu4[2]='<a href="http://www.mysite.com/charter/dice.php">Dice Structures</a>'
menu4[3]='<a href="http://www.mysite.com/boards/list.php?2">Posted Rosters</a>'

var menu5=new Array()
menu5[0]='<a href="http://www.mysite.com/events/">Events</a>'
menu5[1]='Mysite Tournament'
menu5[2]='<a href="http://www.mysite.com/events/event01.php">Information</a>'
menu5[3]='<a href="http://www.mysite.com/boards/list.php?46">Challenges</a>'
menu5[4]='<a href="http://www.mysite.com/boards/list.php?45">Official Fights</a>'
menu5[5]='<a href="http://www.mysite.com/boards/list.php?40">Standings</a>'

var menu6=new Array()
menu6[0]='Role-Play'
menu6[1]='<a href="http://www.mysite.com/boards/list.php?1">Main Mysite Board</a>'
menu6[2]='Official'
menu6[3]='<a href="http://www.mysite.com/boards/list.php?37">Announcements/Updates</a>'
menu6[4]='Development'
menu6[5]='<a href="http://www.mysite.com/boards/list.php?16">Forum Development</a>'
menu6[6]='<a href="http://www.mysite.com/boards/list.php?52">Web Site</a>'
menu6[7]='<a href="http://www.mysite.com/boards/list.php?49">Accepted/Rejected Proposals</a>'

var menu7=new Array()
menu7[0]='<a href="http://www.mysite.com/charter/currency.php">Currency/Bank Laws</a>'
menu7[1]='<a href="http://www.mysite.com/bank/?id=members">Member Accounts</a>'
menu7[2]='<a href="http://www.mysite.com/bank/?id=groups">Group Accounts</a>'
menu7[3]='<a href="http://www.mysite.com/bank/?id=business">Business Accounts</a>'
menu7[4]='<a href="http://www.mysite.com/bank/create.php?id=member">Create Member Account</a>'

var menu8=new Array()
menu8[0]='<a href="http://www.mysite.com/businesses/stores.php">Stores</a>'
menu8[1]='<a href="http://www.mysite.com/businesses/taverns.php">Taverns</a>'
menu8[2]='<a href="http://www.mysite.com/businesses/inns.php">Inns</a>'
menu8[3]='<a href="http://www.mysite.com/businesses/armories.php">Armories</a>'
menu8[4]='<a href="http://www.mysite.com/businesses/shipyards.php">Shipyards</a>'
menu8[5]='<a href="http://www.mysite.com/businesses/stables.php">Stables</a>'
menu8[6]='<a href="http://www.mysite.com/businesses/nightclubs.php">Night Clubs</a>'
menu8[7]='<a href="http://www.mysite.com/businesses/create.php">Create Business</a>'

var menu9=new Array()
menu9[0]='<a href="http://www.mysite.com/assassins/">Listings</a>'
menu9[1]='<a href="http://www.mysite.com/charter/aa.php">AA Laws</a>'
menu9[2]='<a href="http://www.mysite.com/assassins/register.php">Register</a>'

var menu10=new Array()
menu10[0]='<a href="http://www.mysite.com/armory/">Listings</a>'
menu10[1]='<a href="http://www.mysite.com/charter/blacksmith.php">Blacksmith Laws</a>'
menu10[2]='<a href="http://www.mysite.com/armory/register.php">Register</a>'

var menu11=new Array()
menu11[0]='<a href="http://www.mysite.com/clerics/">Listings</a>'
menu11[1]='<a href="http://www.mysite.com/charter/clericlaws.php">Clerical Laws</a>'
menu11[2]='<a href="http://www.mysite.com/clerics/register.php">Register</a>'
menu11[3]='<a href="http://www.mysite.com/clerics/resurrected.php">Those Rezzed</a>'

var menu12=new Array()
menu12[0]='<a href="http://www.mysite.com/healers/">Listings</a>'
menu12[1]='<a href="http://www.mysite.com/charter/healing.php">Healing Laws</a>'
menu12[2]='<a href="http://www.mysite.com/healers/register.php">Register</a>'

var menu13=new Array()
menu13[0]='<a href="http://www.mysite.com/ships/">Listings</a>'
menu13[1]='<a href="http://www.mysite.com/charter/ships.php">Ship Laws</a>'
menu13[2]='<a href="http://www.mysite.com/ships/create.php">Create New</a>'

var menu14=new Array()
menu14[0]='<a href="http://www.mysite.com/enhancers/">For Sale</a>'
menu14[1]='<a href="http://www.mysite.com/enhancers/owned.php">Owned</a>'
menu14[2]='<a href="http://www.mysite.com/charter/enhanceruse.php">Enhancer Laws</a>'
menu14[3]='<a href="http://www.mysite.com/charter/enhancers.php">Create New</a>'

var menu15=new Array()
menu15[0]='<a href="http://www.mysite.com/boards/list.php?31">OOC Board</a>'
menu15[1]='<a href="http://www.mysite.com/character/">Character Files</a>'
menu15[2]='<a href="http://www.mysite.com/player/">Player Files</a>'
menu15[3]='<a href="http://www.mysite.com/links/">Off-Site Links</a>'
menu15[4]='<a href="http://www.mysite.com/adv/">Link To Us</a>'
menu15[5]='<a href="http://www.mysite.com/vote.php">Vote For Us</a>'

var menuwidth='165px' //default menu width
var menubgcolor='lightyellow' //menu bgcolor
var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

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

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu
-->
</script>
<a href="#" onclick="return dropdownmenu(this, event, menu1, '160px')" onmouseout="delayhidemenu()">Main Information</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu2, '160px')" onmouseout="delayhidemenu()">Charter</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu3, '160px')" onmouseout="delayhidemenu()">Join</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu4, '160px')" onmouseout="delayhidemenu()">Groups</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu5, '160px')" onmouseout="delayhidemenu()">Events</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu6, '160px')" onmouseout="delayhidemenu()">Boards</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu7, '160px')" onmouseout="delayhidemenu()">Bank</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu8, '160px')" onmouseout="delayhidemenu()">Businesses</a><br />
<a href="#" onclick="return dropdownmenu(this, event, menu9, '160px')" onmouseout="delayhidemenu()">Assassins</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu10, '160px')" onmouseout="delayhidemenu()">Blacksmiths</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu11, '160px')" onmouseout="delayhidemenu()">Clerics</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu12, '160px')" onmouseout="delayhidemenu()">Healers</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu13, '160px')" onmouseout="delayhidemenu()">Ships</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu14, '160px')" onmouseout="delayhidemenu()">Enhancers</a> &bull;
<a href="#" onclick="return dropdownmenu(this, event, menu15, '160px')" onmouseout="delayhidemenu()">OOC/Mun</a> &bull;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum