求助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么? ie8和ie6在解释脚本时的差别 FF中,怎么弹不出任何内容?? 右键弹出菜单的位置? 有没有好的JS混淆器,推荐一点给小弟,谢谢各位 大散分,js cookies中如何将 cookies设为网站所有目录都共亨的,即不受网站中目录限制!在线急等! 在其它页面用JS取首页(静态HTML页面)URL参数问题 这个在客户端用js能办到吗?关于js 对图形的处理 绝对资料,有你想要的一切。 微博的"@人名"联想功能 这个功能是怎么实现的呢 求助大虾,帮忙看看这种效果的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