刚开始学js,看完了一本js的教程,然后想找个简单的页面看一看,就选了百度首页,以为够简单,结果里面https1.bdstatic.comrwwwcachestaticglobaljshome_f949edf5.js这个文件就已经看得我头昏脑涨,完全看不明白在干什么想放弃了看了几天,今天实在是看不下去了求大牛指点,有没有有谁有推荐的js的视频啊,自己看书看完还是不知道怎么动手写,不知道怎么用,理解的也不透彻
当时学html和css的时候看完一本书就可以上手写了,这js看完一本书还是稀里糊涂
有没有人可以指导一下,让我帮你写东西也成。。JavaScriptCSSHTML百度
当时学html和css的时候看完一本书就可以上手写了,这js看完一本书还是稀里糊涂
有没有人可以指导一下,让我帮你写东西也成。。JavaScriptCSSHTML百度
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type='text/javascirpt'>
var Class = function(){ var klass = function(){
this.init.apply(this, arguments);
};
klass.prototype.init = function(){};
return klass;
};
var Person = new Class;Person.prototype.init = function(){
//
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type='text/javascirpt'>
var Class = function(){ var klass = function(){
this.init.apply(this, arguments);
};
klass.prototype.init = function(){};
return klass;
};
var Person = new Class;Person.prototype.init = function(){
//
javascript高级程序设计
JavaScript语言精粹有时间有耐心的话,看看下面这本,差不多1000页
加油吧,骚年,大家都是这样过来的。
嗯~这个建议不错~~~明天上午准备试试~嘿嘿~我这有个,你看看哪不完善,指点下<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
if(document.documentElement.scrollTop > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var scrollLeft = document.documentElement.scrollLeft;
var scrollTop = document.documentElement.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>
这里:http://download.csdn.net/download/zxy900213/5196607
有一个简单、实用但是又有很多bug的一个数据列表控件你可以拿去帮我完善一下。。
嗯~这个建议不错~~~明天上午准备试试~嘿嘿~我这有个,你看看哪不完善,指点下<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
if(document.documentElement.scrollTop > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var scrollLeft = document.documentElement.scrollLeft;
var scrollTop = document.documentElement.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>$(document.documentElement).animate({'scrollTop': '0'}, 100);这句前面怎么有$符号?
嗯~这个建议不错~~~明天上午准备试试~嘿嘿~我这有个,你看看哪不完善,指点下<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
if(document.documentElement.scrollTop > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var scrollLeft = document.documentElement.scrollLeft;
var scrollTop = document.documentElement.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>$(document.documentElement).animate({'scrollTop': '0'}, 100);这句前面怎么有$符号?把它转换成jquery对象,建议你看看jquery源码
本来这几天挺有热情的,但是因为找了个百度首页的Js文件看,看的我头昏脑涨,不行了那个首页看起来简简单单的啊怎么这么复杂我也想实践,但是不知道做点什么
从W3Cschool开始?
然后要学会浏览器提供的工具 能对js 和 页面进行 编辑调试
你用谷歌或者ff浏览器的 源码查看就可以看出 那个js是干什么的
你可以看看下面的的推荐。我把第一本看了,还是很基础的。对于许多想学习JavaScript的朋友来说,无疑如何选择入门的书籍是他们最头疼的问题,或许也是他们一直畏惧,甚至放弃学习JavaScript的理由。
在JavaScript 方面,自己不是什么专家,也不是什么高手,但自己一路走来,JavaScript 从迷茫到认识,对于JavaScript 书籍的认识或许还有些借鉴价值。入门推荐首选书籍:《JavaScript DOM 编程艺术 》
当初读了不下4遍,书内容简单,易学,上手快,编程思想严谨。好的入门书,对你未来的编程都会有着深远的影响。此本书不辜负这个历史使命。
更详细的评论可以看 Realazy 在 豆瓣 上的评论《通往终点的过程与终点本身同样重要》:http://www.douban.com/review/1105533/基础学习书籍:《JavaScript 权威指南》
《JavaScript DOM 编程艺术 》只是入门,介绍了编程思想和很简单的程序语法以及 DOM 的基本方法。而《JavaScript 权威指南》详尽的介绍了 JavaScript 的各种函数以及特性。至于后面差不多 500 页左右的参考(JavaScript 核心参考、客户端 JavaScript 参考、DOM 参考)可以暂时不看。进阶提升书籍:《JavaScript 高级程序设计》
在思想上强调 OPP 的概念,内容上注重实用,可以从中学到更多更细致的知识,并且注重浏览器差异的解决。 网页教学网
但如果要阅读必须有一定的 JavaScript 的基础(或者读完前两本),要不然会带来挫折感,打击学习的热情。拓展学习篇:《Ajax 实战》
比较全面深入的介绍了 Ajax 知识,其中 Ajax 开发的思想和 Ajax 开发中的设计模式等还是很值得学习。
最好在《JavaScript 高级程序设计》基础上阅读此书,可以很好的帮助理解该书的内容。当然对于没有后台语言基础的朋友来说,阅读起来还是有一定的障碍的。最后想说的:
JavaScript 水平到一定程度,书看得再多也不能得到最后技术的提升,要实践,要自己写代码,深入到开发中锻炼,理论结合实际,才会提升价值。
你可以看看下面的的推荐。我把第一本看了,还是很基础的。对于许多想学习JavaScript的朋友来说,无疑如何选择入门的书籍是他们最头疼的问题,或许也是他们一直畏惧,甚至放弃学习JavaScript的理由。
在JavaScript 方面,自己不是什么专家,也不是什么高手,但自己一路走来,JavaScript 从迷茫到认识,对于JavaScript 书籍的认识或许还有些借鉴价值。入门推荐首选书籍:《JavaScript DOM 编程艺术 》
当初读了不下4遍,书内容简单,易学,上手快,编程思想严谨。好的入门书,对你未来的编程都会有着深远的影响。此本书不辜负这个历史使命。
更详细的评论可以看 Realazy 在 豆瓣 上的评论《通往终点的过程与终点本身同样重要》:http://www.douban.com/review/1105533/基础学习书籍:《JavaScript 权威指南》
《JavaScript DOM 编程艺术 》只是入门,介绍了编程思想和很简单的程序语法以及 DOM 的基本方法。而《JavaScript 权威指南》详尽的介绍了 JavaScript 的各种函数以及特性。至于后面差不多 500 页左右的参考(JavaScript 核心参考、客户端 JavaScript 参考、DOM 参考)可以暂时不看。进阶提升书籍:《JavaScript 高级程序设计》
在思想上强调 OPP 的概念,内容上注重实用,可以从中学到更多更细致的知识,并且注重浏览器差异的解决。 网页教学网
但如果要阅读必须有一定的 JavaScript 的基础(或者读完前两本),要不然会带来挫折感,打击学习的热情。拓展学习篇:《Ajax 实战》
比较全面深入的介绍了 Ajax 知识,其中 Ajax 开发的思想和 Ajax 开发中的设计模式等还是很值得学习。
最好在《JavaScript 高级程序设计》基础上阅读此书,可以很好的帮助理解该书的内容。当然对于没有后台语言基础的朋友来说,阅读起来还是有一定的障碍的。最后想说的:
JavaScript 水平到一定程度,书看得再多也不能得到最后技术的提升,要实践,要自己写代码,深入到开发中锻炼,理论结合实际,才会提升价值。你推荐的几本书都很好,我都看完了,看完并不代表都懂了,特别是《javascript高级程序设计》里面很多都不是很懂,楼主可以问下自己:js有哪些核心的内置对象?js里面的变量的作用域、闭包、匿名函数、面向对象、原型、ajax等等这些基本概念你都会了没?如果不清楚的话再去看书吧~学习任何一门语言,重要的是去实践,多敲书上的代码,看了是不一定会的,学会了原生的js,再去学下基于js的框架吧,推荐楼主使用jQuery,很强大的~
嗯~这个建议不错~~~明天上午准备试试~嘿嘿~我这有个,你看看哪不完善,指点下<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
if(document.documentElement.scrollTop > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var scrollLeft = document.documentElement.scrollLeft;
var scrollTop = document.documentElement.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>$(document.documentElement).animate({'scrollTop': '0'}, 100);这句前面怎么有$符号?把它转换成jquery对象,建议你看看jquery源码想问一下我现在写一些小的js代码用什么工具好哇?dreamweaver可以吗?
嗯~这个建议不错~~~明天上午准备试试~嘿嘿~我这有个,你看看哪不完善,指点下<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
if(document.documentElement.scrollTop > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var scrollLeft = document.documentElement.scrollLeft;
var scrollTop = document.documentElement.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>$(document.documentElement).animate({'scrollTop': '0'}, 100);这句前面怎么有$符号?把它转换成jquery对象,建议你看看jquery源码想问一下我现在写一些小的js代码用什么工具好哇?dreamweaver可以吗?当然可以了,不过比较慢,Notpad++不错,而且还可以折叠代码,速度快
嗯~这个建议不错~~~明天上午准备试试~嘿嘿~我这有个,你看看哪不完善,指点下<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
if(document.documentElement.scrollTop > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var scrollLeft = document.documentElement.scrollLeft;
var scrollTop = document.documentElement.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>$(document.documentElement).animate({'scrollTop': '0'}, 100);这句前面怎么有$符号?把它转换成jquery对象,建议你看看jquery源码想问一下我现在写一些小的js代码用什么工具好哇?dreamweaver可以吗?当然可以了,不过比较慢,Notpad++不错,而且还可以折叠代码,速度快emEditor也行
嗯~这个建议不错~~~明天上午准备试试~嘿嘿~我这有个,你看看哪不完善,指点下<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
if(document.documentElement.scrollTop > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var scrollLeft = document.documentElement.scrollLeft;
var scrollTop = document.documentElement.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>chrome运行出来有问题啊,连那个up的div都不显示
IE正常
我好不容易才看懂。。指点就不行了
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth || document.body.clientWidth;
cH = document.documentElement.clientHeight || document.body.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
var bodys = document.documentElement || document.body;
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
var bodys = document.documentElement || document.body;
if(bodys.scrollTop > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth || document.body.clientWidth;
cH = document.documentElement.clientHeight || document.body.clientHeight;
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>试试
chrome还是不行连那个新加的div都不显示
嗯~这个建议不错~~~明天上午准备试试~嘿嘿~我这有个,你看看哪不完善,指点下<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
if(document.documentElement.scrollTop > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var scrollLeft = document.documentElement.scrollLeft;
var scrollTop = document.documentElement.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>chrome运行出来有问题啊,连那个up的div都不显示
IE正常
我好不容易才看懂。。指点就不行了<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth || document.body.clientWidth;
cH = document.documentElement.clientHeight || document.body.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
var bodys = document.documentElement || document.body;
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
var bodys = document.documentElement.scrollTop || document.body.scrollTop;
if(bodys > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth || document.body.clientWidth;
cH = document.documentElement.clientHeight || document.body.clientHeight;
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>这个是,document.documentElement和document.body的问题,两个都用
嗯~这个建议不错~~~明天上午准备试试~嘿嘿~我这有个,你看看哪不完善,指点下<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
if(document.documentElement.scrollTop > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth;
cH = document.documentElement.clientHeight;
var scrollLeft = document.documentElement.scrollLeft;
var scrollTop = document.documentElement.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>chrome运行出来有问题啊,连那个up的div都不显示
IE正常
我好不容易才看懂。。指点就不行了<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth || document.body.clientWidth;
cH = document.documentElement.clientHeight || document.body.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
var bodys = document.documentElement || document.body;
$(document.documentElement).animate({'scrollTop': '0'}, 100);
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
var bodys = document.documentElement.scrollTop || document.body.scrollTop;
if(bodys > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth || document.body.clientWidth;
cH = document.documentElement.clientHeight || document.body.clientHeight;
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>这个是,document.documentElement和document.body的问题,两个都用这次可以了
终于出现那个up了但是点了没有反应<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
var cW,cH;
function scrolls() {
cW = document.documentElement.clientWidth || document.body.clientWidth;
cH = document.documentElement.clientHeight || document.body.clientHeight;
var _div = document.createElement('div');
_div.className = 'divClass';
_div.appendChild(document.createTextNode('UP'));
_div.id = 'divId';
_div.onclick = function() {
//document.documentElement.scrollTop = '0';
var bodys = document.documentElement || document.body;
var explorer = window.navigator.userAgent ;
if(explorer.indexOf("Chrome") >= 0) {
$(document.body).animate({scrollTop: '0'}, 100);
} else {
$(document.documentElement).animate({scrollTop: '0'}, 100);
}
document.getElementById('divId').style.display = 'none';
}
//_div.setAttribute('onclick', function() {
//document.documentElement.scrollTop = '0';
//document.getElementById('divId').style.display = 'none';
//});
document.body.appendChild(_div);
document.getElementById('divId').style.left = (cW - 40) + 'px';
document.getElementById('divId').style.top = (cH - 40) + 'px';
}
function shang() {
var bodys = document.documentElement.scrollTop || document.body.scrollTop;
if(bodys > 10) {
document.getElementById('divId').style.display = 'block';
} else {
document.getElementById('divId').style.display = 'none';
}
}
function resizediv() {
cW = document.documentElement.clientWidth || document.body.clientWidth;
cH = document.documentElement.clientHeight || document.body.clientHeight;
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
document.getElementById('divId').style.left = (cW - 40 + scrollLeft) + 'px';
document.getElementById('divId').style.top = (cH - 40 + scrollTop) + 'px';
}
window.onload = function() {
scrolls();
}
window.onresize = resizediv;
window.onscroll = function() {
shang();
resizediv();
}
</script>
<style type="text/css">
body { margin:0; padding:0; }
.divClass { width:40px; height:40px; background-color:black; filter:alpha(Opacity=80);-moz-opacity:0.5;opacity: 0.5; position:absolute; color:red; text-align:center; cursor:pointer; display:none; }
</style>
</head>
<body>
<div style='height:1000px;'></div>
</body>
</html>针对谷歌浏览器使用document.body用一下浏览器检测就可以了