Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 11th, 2004, 08:21 PM
Authorized User
Join Date: Feb 2004
Location: Delhi, Delhi, India.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mahulda
Default 2-Level Menu

I want to make a 2-Level Menu .
i.e I have a list of items and when the mouse is positioned above any
item, a separete list would get generated alongside that item.
Somewhat like the Start Menu we all have on our DeskTops.

Is there any way that it can be done using VBScript?

-.. -..
  #2 (permalink)  
Old April 11th, 2004, 09:29 PM
Authorized User
Join Date: Apr 2004
Location: Nanjing, Jiangsu, China.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Mohammed

u can use server side code to generate JS script for this goal.
JS script:

//--------------- main navigator content ------------//
var mainLayer=new Array("menu1","menu2");//main navigator menu

//--------------- sub navigator content ------------//
var subLayer0=new Array("item1","item2"); //sub item1
var subLayerHttp0=new Array("#","#");//sub item1 link
var subLayer1=new Array("item3","item4");//sub item2
var subLayerHttp1=new Array("#","#");//sub item2 link

//--------------- main navigator table parameter ------------//
var mainTableTdWidth=100;
var mainTableBorder=0;
var mainTableCellspacing=0;
var mainTableCellpadding=1;
var mainTableBgcolor="#000000";
var mainTableBordercolor="";
var mainTableBackgroundImg="";
var hrefClassName="link"
var mainTableTdBgcolor="B2CBCF";

var subTableBorder=0;
var subTableCellspacing=0;
var subTableCellpadding=1;
var subTableBgcolor="#000000";
var subTableBordercolor="";
var subTableBackgroundImg="";
var subTableTdBgcolor="B2CBCF";
var sbuTabbleTop=21;
var sbuTabbleLeft=-1;

var layerMax=mainLayer.length+10;
var layerName="index";

//--------------- create drop down menu -----------//
function createMainLayer(){
document.write("<table border=0 cellspacing=0 cellpadding=0><tr><td><div id='wall' onmouseout=layervib('visible','"+layerMax+"') style='position:relative; left:0px; top:0px; width:100%; z-index:1' ><table width="+mainLayer.length*mainTableTdWidth+" border='"+mainTableBorder+"' cellspacing='"+mainTableCellpadding+"' cellpadding='"+mainTableCellpadding+"' bgcolor='"+mainTableBgcolor+"' bordercolor='"+mainTableBordercolor+"' background='"+mainTableBackgroundImg+"'><tr>");
document.write("<td width='"+mainTableTdWidth+"' bgcolor='"+mainTableTdBgcolor+"' class='"+hrefClassName+"' onmouseover=layervib('visible','"+i+"')>&nbsp;<a href='#'>"+mainLayer[i]+"</a></td>");


//--------------- create menu content ------------//
function createSubLayer(num){
var subLayerName= layerName +num;
var subLayerLeft=(mainTableTdWidth*num)+mainTableCellp adding+mainTableBorder;
var subLayerList=eval("subLayer"+num);
var subLayerHttpList=eval("subLayerHttp"+num);
document.write("<div id='"+subLayerName+"' style='position:absolute; left:"+(subLayerLeft+sbuTabbleLeft)+"px; top:"+((mainTableBorder+mainTableCellspacing+mainT ableCellpadding)*2+sbuTabbleTop)+"px; z-index:2; height: 24px; visibility: hidden' onmouseover=layervib('visible','"+num+"') onmouseout=layervib('visible','"+layerMax+"')>");
document.write("<table width='100px' border='"+subTableBorder+"' cellspacing='"+subTableCellpadding+"' cellpadding='"+subTableCellpadding+"' bgcolor='"+subTableBgcolor+"' bordercolor='"+subTableBordercolor+"' background='"+subTableBackgroundImg+"'")

document.write("<tr><td bgcolor='"+subTableTdBgcolor+"' width='100%' class='link'>&nbsp;<a href='"+ subLayerHttpList [h]+"' class='link'>"+subLayerList[h]+"</a>&nbsp;</td></tr>");


//------------------------------show sub item--------------------------//
function layervib(type,num){
var H=type;
var temp=(H='visible'?'hidden':'visible')
for(var i=0;i<mainLayer.length;i++){
var E=eval('document.all.index'+i+'.style');
var H=eval(i);
if(i==num){E.visibility=type}else{E.visibility=tem p};

just save above code as a JS file then call it from any html file like this:
<script language="javascript" src="xxx.js"></script>

hope to help


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
CH 15 Context Menu - Element Menu Items Razzy The Pug BOOK: Ivor Horton's Beginning Visual C++ 2005 2 November 9th, 2008 03:53 PM
how create menubar, menu, menu item in xsl vijayanmsc XSLT 1 June 5th, 2006 06:43 AM
Menu Help in statusbar at mousemove over Menu item Kaustav VB Components 1 September 14th, 2005 09:28 AM
right click menu hidden by drop-drown menu Andraw HTML Code Clinic 0 March 18th, 2005 03:28 PM
Changing Menu made with VB 4 Menu Editor Zooker VB How-To 1 July 26th, 2003 11:44 PM

All times are GMT -4. The time now is 08:13 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.