/    Sign up×
Community /Pin to ProfileBookmark

DropDownListBox displayed over JavaScript based sliding Menu

I have read that DropDownList Box is a windowed control and that you can’t use Z-Index to make any non windowed control to display on top of a windowed control. I have also read that IFrames can be used to overcome this problem. I have also read JoeKing’s blog which talks about using an IFrame shim to cover select box and other windowed controls. Yet, I am stuck here with this sliding menu. I got this sliding menu code from w3Schools web site and it works fine except of the fact that the dropdownlist box shows on top of the menu. I tried the IFrame solution but the sliding menu is no longer working. I don’t know what mistake I am doing here, that it is not working.

I have pasted the code here.

Could someone help me please?

The code …

<code>

<html>
<head>
<style>
body{font-family:arial;}
a{color:black;text-decoration:none;font:bold}
a:hover{color:#606060}
td.menu{background:lightblue}

iframe.nav
{
position:absolute;
font:bold 80%;
top:0px;
left:-135px;
}
</style>
<script type=”text/javascript”>
var i=-135
var intHide
var speed=3
function showmenu()
{
clearInterval(intHide)
intShow=setInterval(“show()”,10)
}
function hidemenu()
{
clearInterval(intShow)
intHide=setInterval(“hide()”,10)
}
function show()
{
if (i<-12)
{
i=i+speed
document.getElementById(‘myMenu’).style.left=i
}
}
function hide()
{
if (i>-135)
{
i=i-speed
document.getElementById(‘myMenu’).style.left=i
}
}
</script>
</head>

<body>
<iframe class=”nav” width=”150″ height=”500″ frameborder=”no” src=”myMenu.html”></iframe>
<table width=100% height =100% border=1>
<tr>
<!–
<td valign=”top”>
<iframe class=”nav” width=”150″ height=”500″ frameborder=”no” src=”myMenu.html”></iframe>
</td>
–>
<td width=100% align=”left” valign=”top”>
<SELECT NAME=”Cats” SIZE=”1″>
<OPTION VALUE=”1″>Calico
<OPTION VALUE=”2″>Tortie
<OPTION VALUE=”3″ SELECTED>Siamese
</SELECT>
</td>
</tr>
</table>

<p>Mouse over the MENU to show/hide the menu</p>
<p>Try changing the “speed” variable in the script, to change the menus’s sliding speed</p>
</body>
</html>

and the code for myMenu.html …

<html>
<head>
<title>My menu</title>
<style>
td.menu{background:lightblue}
</style>
<script type=”text/javascript”>
var i=-135

var intHide
var speed=3
function showmenu()
{
clearInterval(intHide)
intShow=setInterval(“show()”,10)
}
function hidemenu()
{
clearInterval(intShow)
intHide=setInterval(“hide()”,10)
}
function show()
{
if (i<-12)
{
i=i+speed
document.getElementById(‘myMenu’).style.left=i
}
}
function hide()
{
if (i>-135)
{
i=i-speed
document.getElementById(‘myMenu’).style.left=i
}
}
</script>
</head>
<body>
<table id=”myMenu” width=”135″ onmouseover=”showmenu()” onmouseout=”hidemenu()”>
<tr><td class=”menu”><a href=”/default.asp” target=”_top”>HOME</a></td>
<td rowspan=”5″ align=”center” bgcolor=”#FF8080″>M<br>E<br>N<br>U</td></tr>
<tr><td class=”menu”><a href=”/asp/default.asp” target=”_
top”>ASP</a></td></tr>
<tr><td class=”menu”><a href=”/js/default.asp” target=”_top”>JavaScript</a></td></tr>
<tr><td class=”menu”><a href=”default.asp” target=”_
top”>DHTML</a></td></tr>
<tr><td class=”menu”><a href=”/vbscript/default.asp” target=”_top”>VBScript</a></td></tr>
</table>
</body>
</html>

</code>

On doing so, I see a border and a horizontal scroll bar in the Iframe portion and also the menu doesn’t slide across. The sliding action is not working. I don’t know what mistake I am doing.

please help.

kind regards,
S

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@rimianApr 30.2005 — try enclosing your select tag in the <feildset> tag. I seem to remember this working on some site i was building a while ago. i haven't got the solution handy but i know it's something you should explore.
Copy linkTweet thisAlerts:
@Erik777Feb 23.2006 — The moving menu doesn't work when using the mouse wheel! The WCHhider script was very helpful to me but anyhow i still have a problem showing a moving menu at the top of the page. The window controls are hidden very well by the moving menu but the problem is that when they are scrolled back to the bottom of the page, they’re not shown correctly. This problem only occurs when using the mouse wheel, not when i scroll with the left mouse button.

I’ve added a html example here (sorry for the ‘awfull’ code):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head></head>

<body>

<div id="title" style="position:absolute; top:25px; height:30px; width:100%;padding-left:15px; background-color:#E4E4E4; z-index:100">

Do not show!

</div>

<iframe id="DivShim"

scrolling="no"

frameborder="0"

style="position:absolute; top:0px; left:0px; display:none;">

</iframe>

<div id="region-contentBrowse">

<table id="filterTable" border="0">

<tr><td>&nbsp;</td></tr>

<tr><td>&nbsp;</td></tr>

<tr><td>&nbsp;</td></tr>

<tr><td>&nbsp;</td></tr>

<tr>

<td>

<div id="selectbox">

<select name="SEL_IND" size="1">

<option value="AC">Actief</option>

<option value="FU">Toekomstig</option>

<option value="HI">Historie</option>

<option value="AL">Alles</option>

</select>

</td>

</tr>

</table>

</div>

<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>

<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>

<br/><br/><br/><br/><br/><br/><br/><br/>

<script type="text/javascript">

floatingControlTop(document.getElementById("title"),59);

function floatingControlTop(div, iOffset){

if (document.recalc && document.body.attachEvent){

div.style.setExpression("top", "document.body.scrollTop + " + iOffset);
document.body.onscroll=function()
{
document.recalc(true);
DivSetVisible();
//WCH.Apply('title','', true);
document.recalc(true);
};
}

}

function DivSetVisible()

{

var DivRef = document.getElementById('title');

var IfrRef = document.getElementById('DivShim');

var selectRef = document.getElementById('selectbox');

DivRef.style.display = "block";
IfrRef.style.width = DivRef.offsetWidth;
IfrRef.style.height = DivRef.offsetHeight;

IfrRef.style.top = DivRef.style.top;
IfrRef.style.left = DivRef.style.left;
IfrRef.style.zIndex = DivRef.style.zIndex - 1;
IfrRef.style.display = "block";

}

</script>

</body>

</html>

Can someone help me please? I would really appreciate your help! Thanks!

Greetz,

Erik
×

Success!

Help @Sarav16 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...