firefox的容器对象和ie不一样,可以这样
contains可以在ff下扩展下就可以了
<style type="text/css">
.f{
cursor:pointer;
position:absolute;
width:307px !important;/*for firefox,需要减去padding-left*/
width:357px;
height:179px !important;/*for firefox,需要减去padding-top*/
height:194px;
/*宽高设置的是 357 X 194 */
padding:15px 0 0 50px;
background-image:url(http://static5.photo.sina.com.cn/middle/4ef69b3dg5785994300a4&000.jpg)
}
</style>
<script>
var oo = true
//扩展ff下的contains
if(typeof HTMLElement!="undefined")HTMLElement.prototype.contains=function(o){
if(o==this)return true;
while(o=o.parentNode){
if(o==this)return true;
}
return false;
}
function create(){
if(oo==true){
oo=false
var div =document.createElement("div")
div.className="f"
div.id="div"
div.innerHTML="<a href='#'>大法师</a><br>山丘之王<br>血法师<br>怕拉丁"
document.body.appendChild(div)
document.getElementById("div").style.left=document.getElementById("text").offsetLeft+30
document.getElementById("div").style.top=document.getElementById("text").offsetTop
div.onmouseout=del
}}function del(e){
e=e||event;
var obj=e.relatedTarget||e.toElement;
var div =document.getElementById("div")
if(div.contains(obj))return;
document.body.removeChild(div)
oo=true
}</script>
<span id="text" onmouseover="create()" style="cursor:pointer;" onMouseOut="del(event)" >人族</span><br>
<br><br><br>
<div style=" width:357px; height:194px; border:1px dotted #666666; background-image:url(http://static5.photo.sina.com.cn/middle/4ef69b3dg5785994300a4&000.jpg)"> //宽高设置的是 357 X 194
</div>
<img src="http://static5.photo.sina.com.cn/middle/4ef69b3dg5785994300a4&000.jpg">
contains可以在ff下扩展下就可以了
<style type="text/css">
.f{
cursor:pointer;
position:absolute;
width:307px !important;/*for firefox,需要减去padding-left*/
width:357px;
height:179px !important;/*for firefox,需要减去padding-top*/
height:194px;
/*宽高设置的是 357 X 194 */
padding:15px 0 0 50px;
background-image:url(http://static5.photo.sina.com.cn/middle/4ef69b3dg5785994300a4&000.jpg)
}
</style>
<script>
var oo = true
//扩展ff下的contains
if(typeof HTMLElement!="undefined")HTMLElement.prototype.contains=function(o){
if(o==this)return true;
while(o=o.parentNode){
if(o==this)return true;
}
return false;
}
function create(){
if(oo==true){
oo=false
var div =document.createElement("div")
div.className="f"
div.id="div"
div.innerHTML="<a href='#'>大法师</a><br>山丘之王<br>血法师<br>怕拉丁"
document.body.appendChild(div)
document.getElementById("div").style.left=document.getElementById("text").offsetLeft+30
document.getElementById("div").style.top=document.getElementById("text").offsetTop
div.onmouseout=del
}}function del(e){
e=e||event;
var obj=e.relatedTarget||e.toElement;
var div =document.getElementById("div")
if(div.contains(obj))return;
document.body.removeChild(div)
oo=true
}</script>
<span id="text" onmouseover="create()" style="cursor:pointer;" onMouseOut="del(event)" >人族</span><br>
<br><br><br>
<div style=" width:357px; height:194px; border:1px dotted #666666; background-image:url(http://static5.photo.sina.com.cn/middle/4ef69b3dg5785994300a4&000.jpg)"> //宽高设置的是 357 X 194
</div>
<img src="http://static5.photo.sina.com.cn/middle/4ef69b3dg5785994300a4&000.jpg">
解决方案 »
- 使用jquery当radio,id="yes"选中问题?急急急
- 用prototype转发页面?
- js 屏蔽向上一层发送事件怎么做?
- JSP用javabean的时候一直说找不到类?
- 求一种网页的边框效果,我有图片,怎么才能把图片发上来阿?
- 如何实现:点击输入框后,框里原来的文本变成选中状态?
- JavaScript获取URL地址问题,请帮忙,解决当时给分。谢谢
- 各位大虾,javascript如何实现象pb中数据窗口的功能?
- 高分求助在线wait......
- 如何得到select里面的text和value值!(一定要用vbscript)我知道用request.form("kkk")可以的得到value!但是我们看见的值如何得到阿
- 菜鸟的问题,希望大家帮助
- 求一个新窗口打开的退弹代码
那不是ff下不知道ie的东西 都可以想办法扩展拉!~