javascript新闻列表排序简单封装
可以控制列表按日期以及按字数排序.升或者降序.
代码简单封装,按一定的格式调用即可。
代码写的比较繁琐,很多方法用的很原始...
代码如下:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="Design Corp" content="李军" />
<meta name="Designer mail" content="lijunabcxy@163.com" />
</head>
<mce:style type="text/css"><!--
/*<!--[CDATA[*/
ul,li{margin:0;padding:0;list-style-type:none;}
ul{width:450px;padding:10px;border:1px solid #ccc;background:#fafafa;line-height:25px; margin:10px;font-size:12px;}
#news_list li{border-bottom:1px dashed #cde;}
#news_list span{float:right;}
#news_list li a{color:#006;}
/*]]>*/
--></mce:style><mce:style type="text/css" mce_bogus="1"><!--
/*<![CDATA[*/
ul,li{margin:0;padding:0;list-style-type:none;}
ul{width:450px;padding:10px;border:1px solid #ccc;background:#fafafa;line-height:25px; margin:10px;font-size:12px;}
#news_list li{border-bottom:1px dashed #cde;}
#news_list span{float:right;}
#news_list li a{color:#006;}
/*
*/
--></mce:style><style type="text/css" mce_bogus="1" mce_bogus="1">/*<![CDATA[*/
ul,li{margin:0;padding:0;list-style-type:none;}
ul{width:450px;padding:10px;border:1px solid #ccc;background:#fafafa;line-height:25px; margin:10px;font-size:12px;}
#news_list li{border-bottom:1px dashed #cde;}
#news_list span{float:right;}
#news_list li a{color:#006;}
/*
*/</style>
<mce:script type="text/<a href="http://www<a href=" mce_href="ht
相关文档:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!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 ......
1.对于数组,我们可以自己写一个indexOf()方法:
[].indexOf || (Array.prototype.indexOf = function(v){
for(var i = this.length;i-- && this[i] !== v;);
return i; });
使用: var array = new Array();
array = ...;
if(array.ind ......
Event属性和方法:
1. type:事件的类型,如onlick中的click;
2. srcElement/target:事件源,就是发生事件的元素;
3. button:声明被按下的鼠标键,整数,1代表左键,2代表右键,4代表中键,如果按下多个键,酒把这些值加起来,所以3就代表左右键同时按下;(firefox中 0代表左键,1代表中间键,2代表右键) ......
日前,Mozilla 的 Arun Ranganathan 向 W3C 提交了一个草案,旨在推出一个 JavaScript API,让
JavaScript 脚本直接操作本地文件,Firefox 的最新浏览器版本中已经对该 API 提供了大量的支持,不过出于安全考虑,该API
将只对本地文件提供有限的访问。
该 API 引入了一个 FileReader 对象,可以异步加载本地文件系统中的 ......
JS层
// 定义一个全局
var xmlHttp;
// 返回一个xmlHttpRequest对象
function createXMLHttpRequest() {
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
......