从下面的文章即知道,要想不被下拉列表和applet挡住是不可能的,只能让他们invisible。http://www.webreference.com/programming/javascript/form/Form Elements Overlapping A Styled Layer During the process of HTML coding you've probably encountered an annoying form element related problem, which could be described as Form Elements Overlapping a Styled Element. Today, I'll discuss this problem and present an effective workaround for it. If you're wondering why this is a workaround and not a permanent solution, it's "because the big guys (Netscape and Microsoft) don't have one."Let's get to the heart of the matter. This peculiar behavior is caused by the default viewing priorities of the HTML elements. For example: A frame will take priority over all other html elements and will be displayed on top. A form element will take priority over any of the non-form elements Below are some examples of form elements and non-form elements: Form Elements Textarea Select - list box or drop down input type text input type radio input type checkbox Non-Form Elements anchor tag (link) div tag span tag and table tag and all of its tributory elements (thead, tfoot, tbody, tr, td) Among the HTML elements mentioned above are some elements which are known as windowed elements and windowless elements. Today's problem concerns windowed elements. What happens is that the operating system (by default) paints these elements on top of any of the windowless elements that may appear on a given HTML page. At this point, if you think the CSS property z-index is supposed to control the overlapping order of display for any HTML element, then you're right, it should. However, the z-index has no bearing on windowed elements in comparison with the windowless elements.…………
oPopup.document.body.innerHTML = "aaa";
oPopup.document.body.onclick=oPopup.hide
oPopup.show(100,100,50,50);
to: forwardlau(大话西游) 你的上述代码是什么意思?能说明一下吗?
用Popup实现demo.htm<html>
<head>
<title>网页跨框架菜单 </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><frameset rows="92,*" cols="*" framespacing="4" frameborder="yes" border="4">
<frame src="top.htm" name="topFrame" scrolling="NO" >
<frame src="bottom.htm" name="mainFrame">
</frameset>
<noframes><body></body></noframes>
</html>
top.htm<html>
<head>
<title>MSDN的示例</title>
<script>
var oPopup = window.createPopup();
function richContext()
{
var lefter2 = event.offsetY+0;
var topper2 = event.offsetX+15;
oPopup.document.body.innerHTML = oContext2.innerHTML;
oPopup.show(topper2, lefter2, 210, 84, contextobox);
}
</script>
</head>
<body>
<span id="contextobox" style=" cursor:hand; margin-left:5px; margin-right:10px; background:#e4e4e4; width:300; height:40; padding:20px;" oncontextmenu="richContext(); return false" >Right-click inside this box.</span><DIV ID="oContext2" STYLE="display:none">
<DIV STYLE="position:relative; top:0; left:0; border:2px solid black; border-top:2px solid #cccccc; border-left:2px solid #cccccc; background:#666666; height:110px; width:207px;">
<DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" onmouseover="this.style.background='#ffffff'" onmouseout="this.style.background='#cccccc'" onclick="top.mainFrame.location.href='http://www.microsoft.com';">
Home</DIV>
<DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" onmouseover="this.style.background='#ffffff'" onmouseout="this.style.background='#cccccc'" onclick="top.mainFrame.location.href='http://search.microsoft.com';">
Search</DIV>
<DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" onmouseover="this.style.background='#ffffff'" onmouseout="this.style.background='#cccccc'" onclick="top.mainFrame.location.href='http://www.microsoft.com/ie';">
Intenet Explorer</DIV>
<DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" onmouseover="this.style.background='#ffffff'" onmouseout="this.style.background='#cccccc'" onclick="top.mainFrame.location.href='http://www.microsoft.com/info/cpyright.htm';">
©2001 Microsoft Corporation</DIV>
</DIV></body>
</html>
bottom.htm<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body></body>
</html>
<!-- Creation date: 2004-4-9 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title></title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="guoweidong">
<script language="JavaScript1.2">
//Contents for menu 1
var menu1=new Array();
menu1[0]='<a href=Test00.htm>子按钮1</a><br>';
menu1[1]='<a href=Test01.htm>子按钮2</a><br>';
menu1[2]='<a href=Test02.htm>子按钮3</a><br>';
</script>
<style>
<!--
.iewrap1{
position:relative;
height:30px;
}
.iewrap2{
position:absolute;
}
#dropmenu0{
visibility:hidden;
z-index:100;
}
-->
</style></head>
<body>
<script language="JavaScript1.2">
//reusable/////////////////////////////
var zindex=100;
function dropit2(whichone){
if (window.themenu&&themenu.id!=whichone.id)
themenu.style.visibility="hidden";
themenu=whichone;
if (document.all){
themenu.style.left=document.body.scrollLeft+event.clientX-event.offsetX;
themenu.style.top=document.body.scrollTop+event.clientY-event.offsetY+18;
if (themenu.style.visibility=="hidden"){
themenu.style.visibility="visible";
themenu.style.zIndex=zindex++;
}
else{
hidemenu();
}
}
}
function dropit(e,whichone){
if (window.themenu&&themenu.id!=eval(whichone).id)
themenu.visibility="hide";
themenu=eval(whichone);
if (themenu.visibility=="hide")
themenu.visibility="show";
else
themenu.visibility="hide";
themenu.zIndex++;
themenu.left=e.pageX-e.layerX;
themenu.top=e.pageY-e.layerY+19;
return false;
}
function hidemenu(whichone){
if (window.themenu)
themenu.style.visibility="hidden";
}
function hidemenu2(){
themenu.visibility="hide";
}
if (document.all)
document.body.onclick=hidemenu;
//reusable/////////////////////////////
</script>
<!----------Menu 1 starts here---------->
<ilayer height="35px">
<layer visibility="show">
<DIV class="iewrap1" onClick="dropit2(dropmenu0); event.cancelBubble=true;return false" onmouseover="this.style.filter='progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=gold, EndColorStr=#FFFFFF)';"
onmouseout="this.style.filter='';"
STYLE="font-family:verdana; font-size:70%; width:120;height:25px; background:#e4e4e4; border:1px solid black; padding:3px; padding-left:20px; cursor:hand; border-top:0px solid black">
<font face="Verdana">这里可以插图片</font>
</span>
</span>
</div>
</layer>
</ilayer><br>
<!----------Menu 1 ends here---------->
<div id="dropmenu0" style="position:absolute;left:0;top:0;layer-background-color:lightyellow;background-color:lightyellow;width:120;visibility:hidden;border:2px solid black;padding:0px">
<DIV onmouseover="this.style.filter='progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=gold, EndColorStr=#FFFFFF)';"
onmouseout="this.style.filter='';"
STYLE="font-family:verdana; font-size:70%; height:1px; background:#e4e4e4; border:1px solid black; padding:3px; padding-left:20px; cursor:hand; border-top:0px solid black">
<SPAN ONCLICK="parent.location.href='http://www.jsqyw.com'">
给你自已改吧</SPAN>
</DIV>
<script language="JavaScript1.2">
if (document.all)
dropmenu0.style.padding="4px";
for (i=0;i<menu1.length;i++)
document.write(menu1[i]);
</script>
</div>
<script language="JavaScript1.2">
</body>
</html>
During the process of HTML coding you've probably encountered an annoying form element related problem, which could be described as Form Elements Overlapping a Styled Element. Today, I'll discuss this problem and present an effective workaround for it. If you're wondering why this is a workaround and not a permanent solution, it's "because the big guys (Netscape and Microsoft) don't have one."Let's get to the heart of the matter. This peculiar behavior is caused by the default viewing priorities of the HTML elements. For example:
A frame will take priority over all other html elements and will be displayed on top.
A form element will take priority over any of the non-form elements
Below are some examples of form elements and non-form elements: Form Elements
Textarea
Select - list box or drop down
input type text
input type radio
input type checkbox Non-Form Elements
anchor tag (link)
div tag
span tag
and table tag and all of its tributory elements (thead, tfoot, tbody, tr, td)
Among the HTML elements mentioned above are some elements which are known as windowed elements and windowless elements. Today's problem concerns windowed elements. What happens is that the operating system (by default) paints these elements on top of any of the windowless elements that may appear on a given HTML page. At this point, if you think the CSS property z-index is supposed to control the overlapping order of display for any HTML element, then you're right, it should. However, the z-index has no bearing on windowed elements in comparison with the windowless elements.…………
<BODY text="#000000" bgcolor="#ffffff">
<div style="font:14;width:60;color:red;background:black;padding:4"
onmouseover="menu1.style.display=''"
onmouseout="menu1.style.display='none'">
菜单 </div><br/>
<OBJECT
id=menu1
style="display:none;z-index:1000; position:absolute; top:40; left:7; width:152; height: 200;"
type="text/x-scriptlet"
data="caidan.htm"
onmouseover="menu1.style.display=''"
onmouseout="menu1.style.display='none'"></OBJECT>
<SELECT name="select">
<OPTION >fdsgdsfgdsa</OPTION>
<OPTION >fdsgdsfgdsa</OPTION>
<OPTION >fdsgdsfgdsa</OPTION>
<OPTION >fdsgdsfgdsa</OPTION>
<OPTION >fdsgdsfgdsa</OPTION>
</SELECT>
文件二:
<div style='position:absolute;left:0;top:0;width:152;height:200;font:14;color:white;background:black;border:1 solid black'>
<div onclick="alert(this.innerText)">我是大笨狼1</div>
<div onclick="alert(this.innerText)">我是大笨狼2</div>
<div onclick="alert(this.innerText)">我是大笨狼3</div>
<div onclick="alert(this.innerText)">我是大笨狼4</div>
<div onclick="alert(this.innerText)">我是大笨狼5</div>
<div onclick="alert(this.innerText)">我是大笨狼6</div>
<div onclick="alert(this.innerText)">我是大笨狼7</div>
</div>
这个不会被遮挡!
演示:
http://www.adr.gov.cn/download/panyuguang/download/menu.htm