求助div浮动问题 得到一个div,在JS中怎么设置让他始终浮动在屏幕最上方,有滚动条啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <meta http-equiv="content-type" content="text/html; charset=gb2312"> <title> new document </title> <meta name="keywords" content=""> <meta name="description" content=""> </head> <body> <div id="" style="height:1500px;"></div> <div id="kk" style="border:1px solid #f00;width:200px; height:35px; top:0px; position:absolute;">QQ在线</div> <script type="text/javascript"> <!--function newtoponload() { var c = document.getElementById("kk"); function b() { var a = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; setTimeout(function(){c.style.top = (0 + a) + "px"},200); } window.onscroll = b; b()}if (window.attachEvent) { window.attachEvent("onload", newtoponload)} else { window.addEventListener("load", newtoponload, false)} //--> </script> </body></html> <!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> <title>无标题页</title> <style> #head{position:fixed;_position:absolute;top:0px;_top:0px;_margin-top:expression(this.style.pixelHeight+document.documentElement.scrollTop)} </style></head><body style="height:1000px;"> <div id="head" >随意滚动</div></body></html> 谢谢大虾们,可是我只能控制js,不能写在html中写,我是问用js怎么写,我现在能得到div元素,$("div"); 然后用js怎么把那些css样式加上 document.getElementById("mydiv").className="head";#head 改为 .head js 怎样得到UNIX时间戳 菜鸟求助,怎样才能调用到外部JS定义的函数 复杂些的工具条图标拖动?骨灰级定位专家来看看 这个JS语句是什么意思? 请教一段校验:text中只能输入0~5的两位小数,比如3.54,大于5、小于0或者非数字字符都给出错误提示 javascript强制使多个div的高度全部相同 关于<SCRIPT language=VBScript>的问题 应用子帧刷新,对页面的效率有提高吗? 父子窗口问题???先谢谢解答 请问如何做层的隐藏 微博的"@人名"联想功能 这个功能是怎么实现的呢 求助大虾,帮忙看看这种效果的JS代码怎么写
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title> new document </title>
<meta name="keywords" content="">
<meta name="description" content="">
</head> <body>
<div id="" style="height:1500px;"></div>
<div id="kk" style="border:1px solid #f00;width:200px; height:35px; top:0px; position:absolute;">QQ在线</div>
<script type="text/javascript">
<!--
function newtoponload() {
var c = document.getElementById("kk");
function b() {
var a = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
setTimeout(function(){c.style.top = (0 + a) + "px"},200);
} window.onscroll = b;
b()
}
if (window.attachEvent) {
window.attachEvent("onload", newtoponload)
} else {
window.addEventListener("load", newtoponload, false)
}
//-->
</script>
</body>
</html>
<!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>
<title>无标题页</title>
<style>
#head{position:fixed;_position:absolute;top:0px;_top:0px;_margin-top:expression(this.style.pixelHeight+document.documentElement.scrollTop)}
</style>
</head>
<body style="height:1000px;">
<div id="head" >随意滚动</div>
</body>
</html>
#head 改为 .head