<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IE下background-color问题???</title>
<script type="text/javascript" src="jquery.min.js"></script>
<style type="text/css">
#div_top{position:relative;width:1000px;height:700px; left:50px;top:50px;border: 1px solid red;}
.default{position:absolute;width:200px;height:200px;left:120px;top:120px;border: 1px solid red;}
</style>
<script type="text/javascript">
$().ready(function(){
$('.default').click(function(){
alert(11111);
});
});
</script>
<style type="text/css">
</style>
</head>
<body>
<div id="div_top" style="background-color:#9999FF;">
<img src="F:\\picture\\2008111674225421778018.jpg" style="width:1000px;height:700px;"></img>
<div class="default"></div>
</div>
</body>
</html>
如题,当点击<div class="default">这个div时,在IE下竟然没一点反应。但是在FF和chrome下可以正常弹出“11111”。
于是乎替换<body>里边元素:
<div id="div_top" style="background-color:#9999FF;">
<img src="F:\\picture\\2008111674225421778018.jpg" style="width:1000px;height:700px;"></img>
<div class="default" style="background-color:#9999FF;"></div>
</div>
这下在IE中可以弹出。也就是在<div class="default"> 加了个 style="background-color:#9999FF;"难道和这个有关系?答案是有一定关系。
比较相当狠郁闷……以前没怎么整过前台的东西,狠是模糊。经过一系列的摸索,发现与<img>标签有关系。如果没有那个图片,不管有没有style="background-color:#9999FF;"都可以弹出信息。
有知道的朋友也可以给予请教。现在正在探索<img>的问题。