可以模拟一个onclick<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>click</title>
<style type="text/css">
.outer
{
background-color: black;
width: 100px;
height: 100px;
position: relative;
float: left;
z-index: 100;
}
.inner
{
width: 100px;
height: 100px;
float: left;
position: relative;
margin-top: -102px;
z-index: 101;
border: 1px dotted red;
background-color: yellow;
opacity: 0;
filter: alpha(opacity=0);
}
.obj
{
background-color: #dddddd;
width: 100px;
height: 100px;
display: block;
float: left;
border: 1px dotted blue;
}
</style><script>
function Getit(){
alert("ie6");
}
</script>
</head>
<body> <h3>IE6</h3>
<div class="outer">
<OBJECT id="J1" classid=clsid:32C94E07-DEE8-457D-9C0F-168F40ABF32C class="obj"></OBJECT>
<div class="inner" onclick="Getit()"> </div>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>click</title>
<style type="text/css">
.outer
{
background-color: black;
width: 100px;
height: 100px;
position: relative;
float: left;
z-index: 100;
}
.inner
{
width: 100px;
height: 100px;
float: left;
position: relative;
margin-top: -102px;
z-index: 101;
border: 1px dotted red;
background-color: yellow;
opacity: 0;
filter: alpha(opacity=0);
}
.obj
{
background-color: #dddddd;
width: 100px;
height: 100px;
display: block;
float: left;
border: 1px dotted blue;
}
</style><script>
function Getit(){
alert("ie6");
}
</script>
</head>
<body> <h3>IE6</h3>
<div class="outer">
<OBJECT id="J1" classid=clsid:32C94E07-DEE8-457D-9C0F-168F40ABF32C class="obj"></OBJECT>
<div class="inner" onclick="Getit()"> </div>
</div>
</body>
</html>
.inner
{ (...省略了部分)
margin-top: -102px;
}.outer、.inner、.obj这样设置的话:
width: 100px;
height: 100px;单元格会变形得好厉害,如果这样设置margin-top: -102px的话,
inner的onclick事件没反应
还是不是很好,只能在边界上点击才能产生事件