Important alert: (current site time 7/15/2013 1:52:03 PM EDT)
 

VB icon

Drop Down Menu's on Click

Email
Submitted on: 1/27/2001 10:54:06 PM
By: Mike McNaughton  
Level: Advanced
User Rating: By 16 Users
Compatibility: JavaScript
Views: 32014
(About the author)
 
     Advanced Code. With quite a bit of changing this code can be VERY GOOD!!! Try it, if you have a lot of knowledge in internet languages. Please go to the bottom of this page and vote for me. I would greatly appreciate it. THANK YOU!
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: Drop Down Menu's on Click
' Description:Advanced Code. With quite a bit of changing this code can be VERY GOOD!!! Try it, if you have a lot of knowledge in internet languages.
Please go to the bottom of this page and vote for me. I would greatly appreciate it. THANK YOU!
' By: Mike McNaughton
'
' Assumes:Please go to the bottom of this page and vote for me. I would greatly appreciate it. THANK YOU!
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=2071&lngWId=14'for details.'**************************************

<script language="JavaScript">
/********************************************************************************
Copyright © 2000 Michro. All rights reserved.
This script may be used freely as long as this message is intact! ********************************************************************************/
var stayFolded=false
var exImg=new Image(); exImg.src='images/arrow10.gif'
var unImg=new Image(); unImg.src='images/arrow1.gif'
var n = (document.layers) ? 1:0;
var ie = (document.all) ? 1:0;
var browser=((n || ie) && parseInt(navigator.appVersion)>=4) 
function makeMenu(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.'										
	this.css=(n) ? eval(nest+'document.'+obj):eval('document.all.'+obj+'.style')					
 	this.ref=(n) ? eval(nest+'document.'+obj+'.document'):eval('document');		
	this.height=n?this.ref.height:eval(obj+'.offsetHeight')
	this.x=(n)? this.css.left:this.css.pixelLeft;this.y=(n)? this.css.top:this.css.pixelTop;							
	this.hideIt=b_hideIt;	this.showIt=b_showIt; this.vis=b_vis; this.moveIt=b_moveIt											
	return this
}
function b_showIt(){this.css.visibility="visible"}
function b_hideIt(){this.css.visibility="hidden"}
function b_vis(){if(this.css.visibility=="hidden" || this.css.visibility=="hide") return true;}
function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y}
function init(){
	oTop=new Array()
	oTop[0]=new makeMenu('divTop1','divCont')
	oTop[1]=new makeMenu('divTop2','divCont')
	oTop[2]=new makeMenu('divTop3','divCont')
	oTop[3]=new makeMenu('divTop4','divCont')
	oTop[4]=new makeMenu('divTop5','divCont')
	oTop[5]=new makeMenu('divTop6','divCont')
	oSub=new Array()
	oSub[0]=new makeMenu('divSub1','divCont.document.divTop1')
	oSub[1]=new makeMenu('divSub2','divCont.document.divTop2')
	oSub[2]=new makeMenu('divSub3','divCont.document.divTop3')
	oSub[3]=new makeMenu('divSub4','divCont.document.divTop4')
	oSub[4]=new makeMenu('divSub5','divCont.document.divTop5')
	oSub[5]=new makeMenu('divSub6','divCont.document.divTop6')
	for(i=0;i<oSub.length;i++){ oSub[i].hideIt() }
	for(i=1;i<oTop.length;i++){ oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height) }
}
function menu(num){
	if(browser){
		if(!stayFolded){
			for(i=0;i<oSub.length;i++){
				if(i!=num){
					oSub[i].hideIt()
					oTop[i].ref["imgA"+i].src=unImg.src
				}
			}
			for(i=1;i<oTop.length;i++){
				oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height)
			}
		}
		if(oSub[num].vis()){
			oSub[num].showIt()
			oTop[num].ref["imgA"+num].src=exImg.src
		}else{
			oSub[num].hideIt()
			oTop[num].ref["imgA"+num].src=unImg.src
		}
		for(i=1;i<oTop.length;i++){ 
			if(!oSub[i-1].vis()) oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height+oSub[i-1].height) 
			else oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height)
		}
	}
}
if(browser) onload=init;
</script>
<div id="divCont" style="width: 122; height: 211">
	<div id="divTop1" class="clTop"><a href="" onclick="menu(0); return false" class="clMain"><img src="images/arrow1.gif" name="imgA0" width=0 height=0 alt="" border="0"><IMG SRC="http://swo1.hypermart.net/_private/front.gif" width="122" height="21"></a><Br>
		<div id="divSub1" class="clSub" style="width: 63; height: 94">
<!--To change the links, replace the # with the filename or wherever you want the link to go to!-->
			 <a target="Main" href="http://swo1.hypermart.net/join.html" class="clSubb">-Join</a><Br>
			 <a target="Main" href="rules.htm" class="clSubb">-Rules</a><Br>
			 <a target="Main" href="rptips.html" class="clSubb">-Rp Tips</a><Br>
			 <a target="Main" href="begin.html" class="clSubb">-sWo Beginnings</a><Br>
			 <a target="Main" href="hardcore.html" class="clSubb">-sWo Hardcore</a><Br>
<a target="Main" href="htmlhelp.htm" class="clSubb">-sWo HTML Help</a><Br>
		</div>
	</div>
	<div id="divTop2" class="clTop"><a href="" onclick="menu(1); return false" class="clMain"><img src="images/arrow1.gif" name="imgA1" width=0 height=0 alt="" border="0"><IMG SRC="http://swo1.hypermart.net/_private/rp.gif" width="122" height="21"></a><Br>
		<div id="divSub2" class="clSub" style="width: 115; height: 94">
			 <a href="http://iwa-efed.hypermart.net/rpboard" target="_blank" class="clSubb">-Wed/Sat Rp Board</a><Br>
			 <a href="http://swo1.hypermart.net/cgi-bin/index.html" target="_blank" class="clSubb">-PPV Rp Board</a><Br>
			 <a href="http://members2.boardhost.com/pxroy33/" target="_blank" class="clSubb">-OOC Board</a><Br>
			 <a href="http://users3.cgiforme.com/sworpboard/cfmboard.html" target="_blank" class="clSubb">-Back Up Board</a><Br>
			 <a target="Main" href="http://swo1.hypermart.net/cgi-bin/news/index.html" class="clSubb">-News & Rumors Board</a><Br>
		</div>
	</div>
	<div id="divTop3" class="clTop"><a href="" onclick="menu(2); return false" class="clMain"><img src="images/arrow1.gif" name="imgA2" width=0 height=0 alt="" border="0"><IMG SRC="http://swo1.hypermart.net/_private/members.gif" width="122" height="21"></a><Br>
		<div id="divSub3" class="clSub" style="width: 122; height: 94">
			 <a target="Main" href="sworoster.htm" class="clSubb">-Roster</a><Br>
			 <a target="Main" href="titles-rankings.html" class="clSubb">-Titles and Rankings</a><Br>
			 <a target="Main" href="titlehistories.html" class="clSubb">-Title Histories</a><Br>
			 <a target="Main" href="http://swo1.hypermart.net/matchrequest.html" class="clSubb">-Sign a Match</a><Br>
			 <a target="Main" href="http://swo1.hypermart.net/sneak.html" class="clSubb">-Interfear Request</a><Br>
		</div>
	</div>
	<div id="divTop4" class="clTop"><a href="" onclick="menu(3); return false" class="clMain"><img src="images/arrow1.gif" name="imgA3" width=0 height=0 alt="" border="0"><IMG SRC="http://swo1.hypermart.net/_private/results.gif" width="122" height="21"></a><Br>
		<div id="divSub4" class="clSub" style="width: 122; height: 94">
			 <a target="Main" href="http://jjdermont.hypermart.net/wed.html" class="clSubb">-Wed. Revolution</a><Br>
			 <a target="Main" href="sat.html" class="clSubb">-Sat. Combat Zone</a><Br>
			 <a target="Main" href="ppv.htm" class="clSubb">-PPV</a><Br>
			 <a target="Main" href="pastppv.html" class="clSubb">-PPV Archives</a><Br>
			 
		</div>
	</div>
	<div id="divTop5" class="clTop"><a href="" onclick="menu(4); return false" class="clMain"><img src="images/arrow1.gif" name="imgA4" width=0 height=0 alt="" border="0"><IMG SRC="http://swo1.hypermart.net/_private/coming.gif" width="122" height="21"></a><Br>
		<div id="divSub5" class="clSub" style="width: 122; height: 94">
			 
		</div>
	</div>
	<div id="divTop6" class="clTop" style="width: 139; height: 39"><a href="" onclick="menu(5); return false" class="clMain"><img src="images/arrow1.gif" name="imgA5" width=0 height=0 alt="" border="0"><IMG SRC="http://swo1.hypermart.net/_private/coming.gif" width="122" height="21"></a><Br>
		<div id="divSub6" class="clSub" style="width: 79; height: 94">
			 
		</div>
	</div>
 <p>
<!--- Place all page content here --->
</div>
</td>
 </tr>
 <tr><!-- row 3 -->
 </tr>
 <tr><!-- row 4 -->
 </tr>
 <tr><!-- row 5 -->
 </tr>
 <tr><!-- row 6 -->
 </tr>
 <tr><!-- row 7 -->
 </tr>
 <tr><!-- row 8 -->
 </tr>
 <tr><!-- row 9 -->
 </tr>
 <tr><!-- row 10 -->
 </tr>
 <tr><!-- row 11 -->
 </tr>
 <tr><!-- row 12 -->
 </tr>
 <tr><!-- row 13 -->
 </tr>
 <tr><!-- row 14 -->
 </tr>
 <tr><!-- row 15 -->
 </tr>
 <tr><!-- row 16 -->
 </tr>
 <tr><!-- row 17 -->
 </tr>
</table>


Other 15 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

6/24/2003 5:03:03 AM

I am unable to use this on Netscape. NS really gives a lot of problems for drop downs and any dhtml components. Could you help me on this?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.