<div id="FloatDIV" align="center">
<TABLE cellSpacing=0 cellPadding=0 width=212 border=0>
<TBODY>
<TR>
<TD align=middle height=32>
<img src="images/2/index_066.gif" width="215" height="32" alt=""></TD>
</TR>
<tr>
<td align=middle height=55 bgcolor="#ffffff">
<iframe src="http://weather.liehuo.net/weather/54827.htm" width="160" height="55" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</td>
</tr>
</TBODY>
</TABLE>
</div>
<script language="javascript" type="text/javascript">
var MarginLeft = 780; //浮动层离浏览器右侧的距离
var MarginTop = 50; //浮动层离浏览器顶部的距离
var Width =216; //浮动层宽度
var Heigth= 87; //浮动层高度//设置浮动层宽、高
function Set()
{
document.getElementById("FloatDIV").style.width = Width;
document.getElementById("FloatDIV").style.height = Heigth;
}//实时设置浮动层的位置
function Move()
{
document.getElementById("FloatDIV").style.top = document.documentElement.scrollTop + MarginTop;
document.getElementById("FloatDIV").style.left = document.documentElement.clientWidth - Width - MarginLeft;
setTimeout("Move();",100);
}Set();
Move();
</script>
问题:这是定义了一个层,然后其中有一个表格和iframe框,框中引入一个天气预报连接。下面是一段JAVA代码用来实现操纵层,实现随滚动条滚动的效果,但为什么并不滚动呢,错在哪,谢谢
<TABLE cellSpacing=0 cellPadding=0 width=212 border=0>
<TBODY>
<TR>
<TD align=middle height=32>
<img src="images/2/index_066.gif" width="215" height="32" alt=""></TD>
</TR>
<tr>
<td align=middle height=55 bgcolor="#ffffff">
<iframe src="http://weather.liehuo.net/weather/54827.htm" width="160" height="55" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</td>
</tr>
</TBODY>
</TABLE>
</div>
<script language="javascript" type="text/javascript">
var MarginLeft = 780; //浮动层离浏览器右侧的距离
var MarginTop = 50; //浮动层离浏览器顶部的距离
var Width =216; //浮动层宽度
var Heigth= 87; //浮动层高度//设置浮动层宽、高
function Set()
{
document.getElementById("FloatDIV").style.width = Width;
document.getElementById("FloatDIV").style.height = Heigth;
}//实时设置浮动层的位置
function Move()
{
document.getElementById("FloatDIV").style.top = document.documentElement.scrollTop + MarginTop;
document.getElementById("FloatDIV").style.left = document.documentElement.clientWidth - Width - MarginLeft;
setTimeout("Move();",100);
}Set();
Move();
</script>
问题:这是定义了一个层,然后其中有一个表格和iframe框,框中引入一个天气预报连接。下面是一段JAVA代码用来实现操纵层,实现随滚动条滚动的效果,但为什么并不滚动呢,错在哪,谢谢
解决方案 »
- firefox下如何获取客户端mac地址
- 一个简单的问题,计算个数
- 顺手写了一个在浏览器中控制页面某个name的checkbox开关的代码,散散分
- 怎样在浏览器非最大化下让文字不堆在一起啊
- ckeditor的模板问题,请大侠指教
- dhtmlx的一个问题
- 如何用JS来打开一张图片
- 火狐浏览器下,用javascript控制文本框失焦点后,不能再次获得焦点
- /***高分请教:页面Textarea输入域中,为实现计算公式的输入,如何在当前焦点动态赋值,***/
- html框间javascript值传递
- 网页脚本错误,请大侠指导。
- flash 反复播放咋整???在线!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function Set()
{
document.getElementById("FloatDIV").style.width = Width;
document.getElementById("FloatDIV").style.height = Heigth;
}
函数有问题不工作,导致后面无法执行
2.加CSS:position :absolute<!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" xml:lang="zh-CN" lang="zh-CN"><div id="FloatDIV" align="center" style="position :absolute">
<TABLE cellSpacing=0 cellPadding=0 width=212 border=0>
<TBODY>
<TR>
<TD align=middle height=32>
<img src="images/2/index_066.gif" width="215" height="32" alt=""> </TD>
</TR>
<tr>
<td align=middle height=55 bgcolor="#ffffff">
<iframe src="http://weather.liehuo.net/weather/54827.htm" width="160" height="55" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"> </iframe></td>
</tr>
</TBODY>
</TABLE>
</div>
<script language="javascript" type="text/javascript">
var MarginLeft = 780; //浮动层离浏览器右侧的距离
var MarginTop = 50; //浮动层离浏览器顶部的距离
var Width =216; //浮动层宽度
var Heigth= 87; //浮动层高度 //设置浮动层宽、高
function Set(){
document.getElementById("FloatDIV").style.width = Width;
document.getElementById("FloatDIV").style.height = Heigth;
} //实时设置浮动层的位置
function Move(){
document.getElementById("FloatDIV").style.top = document.documentElement.scrollTop + MarginTop;
document.getElementById("FloatDIV").style.left = document.documentElement.clientWidth - Width - MarginLeft;
setTimeout("Move();",100);
} Set();
Move();
</script>
<div style="height:999px;"></div>
{
document.getElementById("FloatDIV").style.top = document.documentElement.scrollTop + MarginTop;
document.getElementById("FloatDIV").style.left = document.documentElement.clientWidth - Width + MarginLeft;
setTimeout("Move();",100);
} FF和IE有点差别...IE先这样...
function Move()
{
if(document.body){
document.getElementById("FloatDIV").style.top = document.body.scrollTop + MarginTop;
document.getElementById("FloatDIV").style.left = document.body.clientWidth - Width - MarginLeft;
}else{
document.getElementById("FloatDIV").style.top = document.documentElement.scrollTop + MarginTop;
document.getElementById("FloatDIV").style.left = document.documentElement.clientWidth - Width - MarginLeft;
}
setTimeout("Move();",1000);
} 改成这样IE和FF都可以了...
sorry.由于是网上拿的代码.没认真检查.
WIN2000:document.documentElement.clientWidth 属性有效
WIN XP: document.documentElement.clientWidth 属性无效,得0,估计这导致代码不执行了,
<!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" xml:lang="zh-CN" lang="zh-CN"><div id="FloatDIV" align="center" style="position :absolute">
<TABLE cellSpacing=0 cellPadding=0 width=212 border=0>
<TBODY>
<TR>
<TD align=middle height=32>
<img src="images/2/index_066.gif" width="215" height="32" alt=""> </TD>
</TR>
<tr>
<td align=middle height=55 bgcolor="#ffffff">
<iframe src="http://weather.liehuo.net/weather/54827.htm" width="160" height="55" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"> </iframe></td>
</tr>
</TBODY>
</TABLE>
</div>
<script language="javascript" type="text/javascript">
var MarginLeft = 780; //浮动层离浏览器右侧的距离
var MarginTop = 50; //浮动层离浏览器顶部的距离
var Width =216; //浮动层宽度
var Heigth= 87; //浮动层高度 //设置浮动层宽、高
function Set(){
document.getElementById("FloatDIV").style.width = Width;
document.getElementById("FloatDIV").style.height = Heigth;
} //实时设置浮动层的位置
function Move(){
document.getElementById("FloatDIV").style.top = document.documentElement.scrollTop + MarginTop;
document.getElementById("FloatDIV").style.left = document.documentElement.clientWidth - Width - MarginLeft;
setTimeout("Move();",100);
} Set();
Move();
</script>
<div style="height:999px;"></div>
现在的代码让我改为了:<div id="FloatDIV" align="center" style="">
<TABLE width=212 border=0 cellPadding=0 cellSpacing=0 bgcolor="#FFFFFF" >
<TR>
<TD><img src="images/2/index_066.gif" width="215" height="32" alt="" /></TD>
</TR>
<tr>
<td>
<iframe src="http://weather.liehuo.net/weather/54827.htm" width="160" height="55" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe> </td>
</tr>
</TABLE>
</div>
<script language="javascript" type="text/javascript">
var MarginLeft = 200; //浮动层离浏览器右侧的距离
var MarginTop = 50; //浮动层离浏览器顶部的距离
var Width =200; //浮动层宽度
var Heigth= 80; //浮动层高度 //设置浮动层宽、高
function Set()
{
document.getElementById("FloatDIV").style.width = Width;
document.getElementById("FloatDIV").style.height = Heigth;
} //实时设置浮动层的位置
function Move()
{
if(document.body){
document.getElementById("FloatDIV").style.top = document.body.scrollTop + MarginTop;
document.getElementById("FloatDIV").style.left = document.body.clientWidth - Width - MarginLeft;
}else{
document.getElementById("FloatDIV").style.top = document.documentElement.scrollTop + MarginTop;
document.getElementById("FloatDIV").style.left = document.documentElement.clientWidth - Width - MarginLeft;
}
setTimeout("Move();",100);
}
Set();
Move();
</script> 究竟是怎么回事啊。
试试
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<meta name="keywords" content="">
<meta name="description" content="">
<title></title><link rel="stylesheet" rev="stylesheet" href="http://www.9191w.net/skin/xunlei2008/css/game_base.css" type="text/css" media="all" />
<link rel="stylesheet" rev="stylesheet" href="http://www.9191w.net/skin/xunlei2008/css/game_index.css" type="text/css" media="all" />
<link rel="stylesheet" rev="stylesheet" href="http://www.9191w.net/skin/xunlei2008/css/style.css" type="text/css" media="all" /></head>
<body>
<div id="FloatDIV" align="center" style="position:absolute">
<TABLE width=212 border=0 cellPadding=0 cellSpacing=0 bgcolor="#FFFFFF" >
<TR>
<TD> <img src="images/2/index_066.gif" width="215" height="32" alt="" /> </TD>
</TR>
<tr>
<td>
<iframe src="http://weather.liehuo.net/weather/54827.htm" width="160" height="55" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"> </iframe> </td>
</tr>
</TABLE>
</div>
<script language="javascript" type="text/javascript">
var MarginLeft = 200; //浮动层离浏览器右侧的距离
var MarginTop = 50; //浮动层离浏览器顶部的距离
var Width =200; //浮动层宽度
var Heigth= 80; //浮动层高度 //设置浮动层宽、高
function Set()
{
document.getElementById("FloatDIV").style.width = Width;
document.getElementById("FloatDIV").style.height = Heigth;
} //实时设置浮动层的位置
function Move()
{
if(document.body){
document.getElementById("FloatDIV").style.top = document.body.scrollTop + document.documentElement.scrollTop + MarginTop;
document.getElementById("FloatDIV").style.left = document.body.clientWidth - Width - MarginLeft;
}else{
document.getElementById("FloatDIV").style.top = document.documentElement.scrollTop + MarginTop;
document.getElementById("FloatDIV").style.left = document.documentElement.clientWidth - Width - MarginLeft;
}
setTimeout("Move();",100);
}
Set();
Move();
</script>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>也可能是doctype的原因.试试上面的.