Groups | Blog | Home
all groups > dotnet jscript > july 2003 >

dotnet jscript : JavaScript menu and ListBox control problem


bruce barker
7/15/2003 10:05:03 AM
with IE, the <select> is in a z-order above all html. there are two common
solutions:

1) when the flyout menu rendered, the select is marked as hidden.
2) render the menu in a iframe. you can get the iframe's z-order to be in
front of the select. you must size and position the iframe to be the same
size and location of the menu, as it will hide the underlying html. hint: if
the browser is not IE, use a div to keep the code mostly compatiable.

-- bruce (sqlwork.com)

[quoted text, click to view]

Nash
7/15/2003 3:42:32 PM
I have this page with JavaScript menu and some ListBox controls. The
problem is when menus are open, they should show above those list boxes, but
they are allways beneath it. Guess it's a problem with HTML SELECT control
that is ASP.NET ListBox rendered to, but I can't find a way out of this
problem.
Anyone solved this problem?



Nash
7/16/2003 9:59:31 AM
Hi Bruce,
thanks for the reply.
However, there is a problem. Is there some setting on the IFrame that I have
to set for it to show JavaScript menu? I made html file that contains this
menu, but when it is put in the IFrame, it doesn't show at all.

[quoted text, click to view]

bruce barker
7/16/2003 12:46:32 PM
no. and iframe is just another browser window. put scrollbars on the iframe,
and see if the menu is clipped by the iframe.



[quoted text, click to view]

Darren Webb
7/24/2003 12:43:46 PM

This depends just how far you want to go.
In the case of netscape it does not let
the SELECT shine through the menu DIV system.

In the case of Microsoft Internet Explorer
you need to wrap the SELECT inside a positionable DIV
what you do is hide the DIV if
the menu expanded is on the same physical location.

You can go to dhtmlcentral.com and find such things
buried in the alternative downloads.

I know because I first supplied those guys with a
'how to' and they improved on it.

Below is what I sent them regarding DIV windows.
if you email me at darrenwebb@btinternet.com
I will hunt out the div around select menu code


<html>
<head>
<title>Windows Script</title>
<META NAME="Author" CONTENT="Thomas Brattli
(webmaster@dhtmlcentral.com)">
<META NAME="Generator" CONTENT="Re Designer:Darren Webb
(www.montegodata.co.uk)">

<style type="text/css">
..clWin {position:absolute; z-index: 2;
visibility:hidden; overflow:hidden; background-color:blue}
..clWindow {position:absolute; z-index:15; width:200;
background-color:blue; overflow:hidden;}
..clWinHead {position:absolute; top:0; width:200;
font-family:arial,helvetica; font-size:11px; font-
weight:bold; color:white; background-color:transparent}
..clText {position:absolute; z-index:50; font-
family:arial,helvetica; font-size:11px; background-
color:transparent}
..clLogo {position:absolute;}
..clWinButtons{position:absolute; font-
family:arial,helvetica; font-size:12px;}
..clUp {position:absolute; z-index:60; width:12;
height:12;}
..clDown {position:absolute; z-index:60; width:12;
height:12;}
..clLeft {position:absolute; z-index:60; width:12;
height:12;}
..clRight {position:absolute; z-index:60; width:12;
height:12;}
..clWinResize {position:absolute; z-index:30; width:30;
height:30; clip:rect(0,30,30,0); background-image:url
(resize.gif); layer-background-image:url(resize.gif)}
..tdData {font-family: Arial; font-size: 10px; line-
height:9px;}
</style>

<script language="JavaScript" src="Lib_Core.js"></script>

<script language="JavaScript" type="text/javascript">
/**********************************************************
**********************
Copyright (C) 2001 DHTMLCentral.com
This script is made by Thomas Brattli and copyrighted to
DHTMLCentral.com
Visit for more great scripts.
This may be used freely as long as this msg is intact!
We will also appreciate any links you could give us.
Tile,Cascade,HorizontalScroll(Table) and Widget Hiding
Added By Darren Webb
***********************************************************
*********************/


function mdown(e) //Mousedown
{
x=(bw.ns4 || bw.ns6)?e.pageX:event.x||event.clientX
y=(bw.ns4 || bw.ns6)?e.pageY:event.y||event.clientY
if(bw.ie5 || bw.ie6) y+=document.body.scrollTop

var id=-1;
if (bw.ns4)
{
routeEvent(e)
}
else if (oWin.resizeover>-1)
{
id=oWin.resizeobj=oWin.resizeover;
}
else if(oWin.dragover>-1)
{
id=oWin.dragobj=oWin.dragover;
oWin.clickedX=x-oWin[id].x;
oWin.clickedY=y-oWin[id].y;
}

if (id>-1)
{
oWin[id].UpdateIndex()

for ( var i = 0; i < oWin.length ; i++ )
{
oWin[i].oWindow.bg( i==id ? oWin
[i].defbga: oWin[i].defbg )
}
DisplayWidget( id ) ;
} /* else {minimised pressed} */

if(!bw.ns4) return false;
}

function mup(e) //Mouseup
{
if(oWin.dragobj!=-1)
{
var id = oWin.dragobj;
oWin[id].lastx=oWin[id].x;
oWin[id].lasty=oWin[id].y;
}
oWin.dragobj=-1

if(oWin.resizeobj!=-1)
{
var id = oWin.resizeobj
oWin[id].ScrollVerticalCheck()
oWin[id].ScrollHorizontalCheck()
oWin[id].origw=oWin[id].cr
oWin[id].origh=oWin[id].cb
}
else if(bw.ns4) routeEvent(e)

oWin.resizeobj=-1
}

function mmove(e) //Mousemove
{
x=(bw.ns4 || bw.ns6)?e.pageX:event.x||event.clientX
y=(bw.ns4 || bw.ns6)?e.pageY:event.y||event.clientY

if(bw.ie5 || bw.ie6) y+=document.body.scrollTop

id1=oWin.dragobj
id2=oWin.resizeobj

if(id2>-1) //Resize
{
oWin[id2].cr = x - oWin[id2].x < 120 ?
120 : x - oWin[id2].x;
oWin[id2].cb = y - oWin[id2].y < 100 ?
100 : y - oWin[id2].y;
oWin[id2].Resize(oWin[id2].cr,oWin[id2].cb)
DisplayWidget( id2, 'S' ) ;
}
else if(id1>-1) //Move
{
nx = x-oWin.clickedX;
ny = y-oWin.clickedY < oWin.starty ?
oWin.starty : y-oWin.clickedY;

if( oWin.keepinside )
{
if (nx+oWin[id1].cr>eval
(oWin.maxX)) nx=eval(oWin.maxX)-oWin[id1].cr
else if(nx< eval
(oWin.minX)) nx=eval(oWin.minX)

if (ny+oWin[id1].cb>eval
(oWin.maxY)) ny=eval(oWin.maxY)-oWin[id1].cb
else if(ny< eval
(oWin.minY)) ny=eval(oWin.minY)
}
oWin[id1].x=nx
oWin[id1].y=ny
oWin[id1].moveIt(nx,ny)
DisplayWidget( id1, 'M' ) ;
}

if(!bw.ns4) return false;
}

function w_mmover(num,resize){ if(!resize)
oWin.dragover=num; else oWin.resizeover=num }
function w_mmout() { oWin.dragover=-1;
oWin.resizeover=-1 }

function mdblclick(e,num)
{
if(num>-1) oWin[num].Maximize();
else if(oWin.dragover>-1) oWin
[oWin.dragover].Maximize();
}

function w_resize(w,h)
{
this.oButtons.moveIt(w-oWin.buttonsw,0);
this.oResize.moveIt(w-oWin.resizew,h-oWin.resizeh)
this.oWindow.clipTo(w-oWin.bordersize*2,h-
oWin.bottomh-oWin.headh);
this.clipTo(w,h);
this.oHead.clipTo(w,oWin.headh);
this.oText.moveIt(2,3)
this.ScrollVerticalCheck();
this.ScrollHorizontalCheck();
}

function w_regular()
{
this.oResize.css.visibility="inherit"
this.Resize(this.origw,this.origh)
this.moveIt(this.lastx,this.lasty)
this.state="reg";
this.UpdateIndex()
DisplayWidget( 0 )
}

function w_maximize()
{
if (this.state!="max")
{
if(this.state!="min"){this.lastx=this.x;
this.lasty=this.y}

this.moveIt(10,oWin.starty)
this.Resize(winpage.x2 - 10,winpage.y2 -
10 - oWin.starty);
this.oResize.showIt();
this.state="max"
this.UpdateIndex()
DisplayWidget( 0 )
}
else
{
this.Regular()
}
}

function w_minimize()
{
if(this.state!="min")
{
if(this.state!="max"){this.lastx=this.x;
this.lasty=this.y}
this.state="min";

y=winpage.y2-oWin.headh; ox=winpage.x2-
126; a=0

for(i=0;i< oWin.length;i++)
{
x=i*125;
ok=a

if(a*125>ox){if(ox>126) i=0; a=0;
y-=oWin.headh; x=0}

for(j=0;j < oWin.length;j++)
{
if(oWin[j].x==x && oWin
[j].y==y) a++
}
if(a==ok) break;
}
x=a*125;
this.moveIt(x,y);
this.oResize.hideIt()
this.Resize(125,oWin.headh)
this.oUp.hideIt();
this.oDown.hideIt();
this.oLeft.hideIt();
this.oRight.hideIt();
this.UpdateIndex(100)
DisplayWidget( 0 )
}
else
{
this.Regular()
}
}

function w_close()
{
var i;
var dID;
var j;
var dI;
var id=-1;

this.state='close'
AddThis Social Bookmark Button