Javascript实现滚动新闻
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>滚动新闻类</title>
<style type="text/css">
body {
text-align:center;
}
td {
font-size:12px;
line-height:20px;
text-align:left;
}
.marquee {
width:100%;
height:100%;
overflow:hidden;
}
.m {
height:20px;
}
.m2 {
height:90px;
}
</style>
</head>
<body>
<table border='1'>
<tr>
<td height='20' width='250'><div id='marquee1' class='marquee m'></div></td>
<td height='20' width='300'><div id='marquee2' class='marquee m'></div></td>
</tr>
<tr>
<td height='99' colspan='2'>基本上够用了吧!</td>
</tr>
<tr>
<td height='90' colspan='2'><div id='marquee3' class='marquee m2'></div></td>
</tr>
</table>
<script language="JavaScript">
function BYMarquee(){
this.Content = []; //显示内容
this.Speed = 20; //上移速度
this.Object = {}; //marquee容器对象
this.Pause = true; //是否停留
this.Start = function(){
var o = this.Object;
&nbs
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
1.创建节点并添加内容:使用的方法:createElement和createTextNode
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>HTML DOM</title>
&nbs ......
正则表达式是一个描述字符模式的对象。
JavaScript的RegExp对象和String对象定义了使用正则表达式来执行强大的模式匹配和文本检索与替换函数的方法.
在JavaScript中,正则表达式是由一个RegExp对象表示的.当然,可以使用一个RegExp()构造函数来创建RegExp对象,也可以用
JavaScript
1.2中的新添加的一个特殊语法 ......
看了很多javascrip代码,发现很多地方用到了this这个对象,那这个到底是什么东西阿?
先让我们来理解一个概念:
在javascript会有一个上下文的概念,任何一个对象无论是Object 还是function 都会有一个专有的上下文对象,也可以理解为它自己的拥有者。
那么我们很容易想到这个拥有者,必然有个终点,那就是window对象。
......
1、插入排序->直接插入法排序
function InsertSort(arr) { //插入排序->直接插入法排序
var st = new Date();
var temp, j;
for(var i=1; i<arr.length; i++) {
if((arr[i]) < (arr[i-1])) {
temp = arr[i];
j = i-1;
do {
arr[j+1] = arr[j];
j--;
}
whil ......