有以下一个样式和两个函数
<style type="text/css">
body {
margin-top: 0px;
margin-left: 0px;
width: 100%;
}
</style><script type="text/javascript">
function mouseOver()
{
source=event.srcElement;
source.style.background="url(images/gisbutton1.png)";
}
function mouseOut()
{
source=event.srcElement;
source.style.background="url(images/gisbutton2.png)";
}
</script>
在IE8里面浏览没有任何问题,但是在火狐浏览器里边样式表中的width=100%似乎不起作用,而且两个js函数也不起作用,请问这是为什么?
<style type="text/css">
body {
margin-top: 0px;
margin-left: 0px;
width: 100%;
}
</style><script type="text/javascript">
function mouseOver()
{
source=event.srcElement;
source.style.background="url(images/gisbutton1.png)";
}
function mouseOut()
{
source=event.srcElement;
source.style.background="url(images/gisbutton2.png)";
}
</script>
在IE8里面浏览没有任何问题,但是在火狐浏览器里边样式表中的width=100%似乎不起作用,而且两个js函数也不起作用,请问这是为什么?
解决方案 »
- 如何获得一组<select></select>中的文本值
- 请问DTREE是怎样把节点显示到页面上去的
- JavaScript疑难问题
- 火星人的耳机 - 趣谈web开发标准
- 怎样取得菜单值,并据值改变另一个文本框的显示和隐藏
- 请教:不同FRAME对象的onclick事件追加
- 求助:jsp页面 中多条数据的保存问题
- 用浏览器全屏播放pdf格式的文件,如何实现页面切换
- 在javascript里写代码,在点击时显示一个图片,再点击时图片消失,请问高手怎么实现?
- 急着用!请教各位高手:如何用javascript实现类似OICQ里菜单的升降功能?
- 凤凰网页面上的那个“内容推荐”的新闻导航条怎么实现的?
- JS里面金额显示问题:parseFloat(Amt).toLocaleString();
body加上100%有什么含义呢?
设置body的宽度为100%使其在浏览器上没有两边的空白,也就是占满整个window对象区域
{
var event = arguments[0]||window.event;
source=event.srcElement;
source.style.background="url(images/gisbutton1.png)";
}function mouseOut()
{
var event = arguments[0]||window.event;
source=event.srcElement;
source.style.background="url(images/gisbutton2.png)";
}
{
e = e || event;
var source = e.srcElement || e.target;
source.style.background="url(images/gisbutton1.png)";
}function mouseOut(e)
{
e = e || event;
var source = e.srcElement || e.target;
source.style.background="url(images/gisbutton2.png)";
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>mydiv</title>
<style type="text/css" rel="Stylesheet">
body {
margin-top: 0px;
margin-left: 0px;
width: 100%;
}
</style> <script type="text/javascript">
function mouseOver(e){
var event = e || event;
var source=event.srcElement || e.target;
source.style.background="url(images/1.png)";
} function mouseOut(e){
var event = e || event;
var source=event.srcElement || e.target;
source.style.background="url(images/2.png)";
}
</script>
</head>
<body>
<div style="position:absolute;left:100px;top:100px;width:200px;height:200px;border:solid 1px black;" onmouseover="mouseOver(event);" onmouseout="mouseOut(event)"></div>
</body>
</html>
各种浏览器测试都通过了. lz的原因可能是鼠标划过的地方被其他div覆盖了. 没有触发到mouseOver和mouseOut, LZ检查一下各种样式. 可以在函数第一句alert一下看进入到此函数没