24
Nov.2010
提供定位函数,用iframe作载体,不会被select挡住
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
<HTML>
<head>
<meta http-equiv="Content-Type" content="text/HTML; charset=gb2312">
<title>层遇到select框时使层不被select挡住</title>
<!--
提供定位函数,用iframe作载体,不会被select挡住
By Fason(2003-5-21)
-->
<style id="s">
#div1{
position:absolute;
z-index:100;
width:100;
height:130;
background-color:#d2e8ff;
border:1 solid black;
}
div{cursor:hand;font-size:12px;}
a{text-decoration:none;color:red;font-size:12px}
</style>
<script>
function window.onload(){
var sHTML=div1.innerHTML;
var ifm=document.createElement("<iframe frameborder=0 marginheight=0 marginwidth=0 hspace=0 vspace=0 scrolling=no></iframe>")
ifm.style.width=div1.offsetWidth
ifm.style.height=div1.offsetHeight
ifm.name=ifm.uniqueID
div1.innerHTML=""
div1.appendChild(ifm)
window.frames[ifm.name].document.write(s.outerHTML+"<body leftmargin=0 topmargin=0>"+sHTML+"</body>")
}
function show(){
with(document.all.img1){
x=offsetLeft;
y=offsetTop;
objParent=offsetParent;
while(objParent.tagName.toUpperCase()!= "BODY"){
x+=objParent.offsetLeft;
y+=objParent.offsetTop;
objParent = objParent.offsetParent;
}
y+=offsetHeight-1
}
with(document.all.div1.style){
pixelLeft=x
pixelTop=y
visibility=''
}
}
function hide(){
document.all.div1.style.visibility='hidden'
}
</script>
</head>
<body>
<img id=img1 onmouseover="show()" onmouseout="hide()" src="ie.gif"><br><select style="width: 124px;"></select>
<div id=div1 onmouseover="style.visibility=''" onmouseout="style.visibility='hidden'" style="visibility:hidden;">
<div href="http://www.husw.net" onmouseover="style.backgroundColor='highlight'" onmouseout="style.backgroundColor=''" onclick="window.open(href)">在路上</div>
<div href="http://www.husw.net" onmouseover="style.backgroundColor='highlight'" onmouseout="style.backgroundColor=''" onclick="window.open(href)">husw.net</div>
</div>
</body>
</HTML>
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
<HTML>
<head>
<meta http-equiv="Content-Type" content="text/HTML; charset=gb2312">
<title>层遇到select框时使层不被select挡住</title>
<!--
提供定位函数,用iframe作载体,不会被select挡住
By Fason(2003-5-21)
-->
<style id="s">
#div1{
position:absolute;
z-index:100;
width:100;
height:130;
background-color:#d2e8ff;
border:1 solid black;
}
div{cursor:hand;font-size:12px;}
a{text-decoration:none;color:red;font-size:12px}
</style>
<script>
function window.onload(){
var sHTML=div1.innerHTML;
var ifm=document.createElement("<iframe frameborder=0 marginheight=0 marginwidth=0 hspace=0 vspace=0 scrolling=no></iframe>")
ifm.style.width=div1.offsetWidth
ifm.style.height=div1.offsetHeight
ifm.name=ifm.uniqueID
div1.innerHTML=""
div1.appendChild(ifm)
window.frames[ifm.name].document.write(s.outerHTML+"<body leftmargin=0 topmargin=0>"+sHTML+"</body>")
}
function show(){
with(document.all.img1){
x=offsetLeft;
y=offsetTop;
objParent=offsetParent;
while(objParent.tagName.toUpperCase()!= "BODY"){
x+=objParent.offsetLeft;
y+=objParent.offsetTop;
objParent = objParent.offsetParent;
}
y+=offsetHeight-1
}
with(document.all.div1.style){
pixelLeft=x
pixelTop=y
visibility=''
}
}
function hide(){
document.all.div1.style.visibility='hidden'
}
</script>
</head>
<body>
<img id=img1 onmouseover="show()" onmouseout="hide()" src="ie.gif"><br><select style="width: 124px;"></select>
<div id=div1 onmouseover="style.visibility=''" onmouseout="style.visibility='hidden'" style="visibility:hidden;">
<div href="http://www.husw.net" onmouseover="style.backgroundColor='highlight'" onmouseout="style.backgroundColor=''" onclick="window.open(href)">在路上</div>
<div href="http://www.husw.net" onmouseover="style.backgroundColor='highlight'" onmouseout="style.backgroundColor=''" onclick="window.open(href)">husw.net</div>
</div>
</body>
</HTML>
相关日志
vue微信网页授权解决方案
jQuery AJAX 方法 success()后台传来的4种数据
比较靠谱的Javascript库(Jquery、bootstrap、dojo、mootools、prototype、yui、zepto等)的可用CDN大全
css栅格化网站设计(栅栏布局模块化命名)
CSS 中对 display:inline-block 的深入理解
vue微信网页授权解决方案
jQuery AJAX 方法 success()后台传来的4种数据
比较靠谱的Javascript库(Jquery、bootstrap、dojo、mootools、prototype、yui、zepto等)的可用CDN大全
css栅格化网站设计(栅栏布局模块化命名)
CSS 中对 display:inline-block 的深入理解
