有以下一个样式和两个函数
<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函数也不起作用,请问这是为什么?
解决方案 »
- js调用ocx问题,急啊。。。。
- 一段JS验证代码,可有高人来简化下
- 怎样去掉树形菜单的小加号
- 求一个关于密码验证的正则表达式,想了好久都找不到简短的解决方案
- 如何在document.write ("<%=inrs(1)%> 加入") 里加空格
- 谁帮解释一下dreamweaver中的一段示例代码?
- createElement("iframe")问题
- 关于javascript调用iframe对象的问题。
- 一个文件上传域的问题,我想动态改变上传文件,能否在javascript中实现??
- 如何检测输入的日期的有效性!
- 凤凰网页面上的那个“内容推荐”的新闻导航条怎么实现的?
- 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一下看进入到此函数没