<!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" />
<meta http-equiv="Content-Language" content="utf-8" />
<meta name="robots" content="all" />
<meta name="keywords" content="yaohaixiao.com,Javascript,newsCarousel,滚动新闻特效,focus on javascript" />
<meta name="description" content="yaohaixiao.com - Focus on javascript." />
<title>newsCarousel - 滚动新闻特效</title>
<link href="http://www.yaohaixiao.com/css/yao.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/newscarousel.css" rel="stylesheet" type="text/css" media="screen" />
<base target="_blank" />
</head>
<body>
<div id="hd">
<h1><strong>YAO</strong>HAIXIAO.COM</h1>
<blockquote>FOCUS ON JAVASCRIPT</blockquote>
<ul id="navigation">
<li><a href="http://www.yaohaixiao.com/index.html">网站首页</a></li>
<li class="current"><a href="http://www.yaohaixiao.com/javascript/index.html">我的Javascript空间</a></li>
<li><a href="http://www.yaohaixiao.com/tools/index.html">Javascript 开发工具</a></li>
<li><a href="http://www.yaohaixiao.com/resource/index.html">Javascript 资源链接</a></li>
<li><a href="http://www.yaohaixiao.com/books/index.html">Javascript 好书推荐</a></li>
<li><a href="http://www.yaohaixiao.com/about/index.html">关于</a></li>
</ul>
</div>
<div class="wrap">
<div id="script">
<h1>newsCarousel - 滚动新闻特效</h1>
<div id="byline">程序开发:<a href="http://www.yaohaixiao.com/">YAOHAIXIAO.COM</a>发表时间:2010 - 01 - 27</div>
<div id="y-today">
<div id="yt-mod">
<ul id="yt-carousel">
<li>
<div class="yt-bd">
<h2><a href="http://www.yaohaixiao.com/?p=621" target="_blank" title="for in Intrigue"><img src="samples/2.jpg" alt="for in Intrigue" /></a></h2>
<h3><a href="http://www.yaohaixiao.com/?p=621" target="_blank">for in Intrigue</a></h3>
<p> One of JavaScript’s best features is the ability to augment the built-in types. If we want to add a new method to a type, we simply assign a function to the type’s prototype.[<a href="http://www.yaohaixiao.com/?p=621" target="_blank">Details</a>]</p>
</div>
</li>
</ul>
</div>
</div>
<h2>程序简介</h2>
<p>
<strong>newsCarousel - 滚动新闻特效</strong>,我用我自己写的YaoUI代码库,模仿的YAHOO.COM新版首页的一个滚动新闻效果,新闻滚动的瞬间加载JSON数据。功能实用,调用简单,兼容性好,希望大家能喜欢。
</p>
<h2>调用方法</h2>
<p>
<strong>第一步:</strong>在页面中调用yao.js文件,例如:
</p>
<p>
<script type="text/javascript" src="js/yao.js"></script>
</p>
<p><strong>第二步:</strong>编写调用代码:<br />
<pre>
(function(){
var newsCarousel = new YAO.newsCarousel({
carouselCnt: YAO.getEl('yt-mod'),
carousel: YAO.getEl('yt-carousel'),
items: 'li',
root: YAO.getEl('y-today'),
ajaxable: true,
ajaxItemNum: 9
});
newsCarousel.init();
})();
</pre>
</p>
<h2>程序代码</h2>
<textarea>
var YAO = function(){
var D = document, OA = '[object Array]', OF = "[object Function]", OP = Object.prototype, nt = "nodeType", listeners = [], webkitKeymap = {
63232: 38, // up
63233: 40, // down
63234: 37, // left
63235: 39, // right
63276: 33, // page up
63277: 34, // page down
25: 9 // SHIFT-TAB (Safari provides a different key code in
}, patterns = {
HYPHEN: /(-[a-z])/i,
ROOT_TAG: /body|html/i
}, lastError = null;
return {
isArray: function(obj){
return OP.toString.apply(obj) === OA;
},
isString: function(s){
return typeof s
=== 'string';
},
isBoolean: function(b){
return typeof b === 'boolean';
},
isFunction: function(fn){
return OP.toString.apply(fn) === OF;
},
isNull: function(obj){
return obj === null;
},
isNumber: function(num){
return typeof num === 'number' && isFinite(num);
},
isObject: function(str){
return (str && (typeof str === "object" || this.isFunction(str))) || false;
},
isUndefined: function(obj){
return typeof obj === 'undefined';
},
hasOwnProperty: function(obj, prper){
if (OP.hasOwnProperty) {
return obj.hasOwnProperty(prper);
}
return !this.isUndefined(obj[prper]) && obj.constructor.prototype[prper] !== obj[prper];
},
isMobile: function(mobile){
return /^(13|15|18)\d{9}$/.test(YAO.trim(mobile));
},
isName: function(name){
return /^[\w\u4e00-\u9fa5]{1}[\w\u4e00-\u9fa5 \.]{0,19}$/.test(YAO.trim(name));
},
keys: function(obj){
var b = [];
for (var p in obj) {
b.push(p);
}
return b;
},
values: function(obj){
var a = [];
for (var p in obj) {
a.push(obj[p]);
}
return a;
},
isXMLDoc: function(obj){
return obj.documentElement && !obj.body || obj.tagName && obj.ownerDocument && !obj.ownerDocument.body;
},
formatNumber: function(b, e){
e = e || '';
b += '';
var d = b.split('.');
var a = d[0];
var c = d.length > 1 ? '.' + d[1] : '';
var f = /(\d+)(\d{3})/;
while (f.test(a)) {
a = a.replace(f, '$1,$2');
}
return e + a + c;
},
unformatNumber: function(a){
return a.replace(/([^0-9\.\-])/g, '') * 1;
},
stringBuffer: function(){
var a = [];
for (var i = 0; i < arguments.length; ++i) {
a.push(arguments[i]);
}
return a.join('');
},
trim: function(str){
try {
return str.replace(/^\s+|\s+$/g, '');
}
catch (a) {
return str;
}
},
stripTags: function(str){
return str.replace(/<\/?[^>]+>/gi, '');
},
stripScripts: function(str){
return str.replace(/<script[^>]*>([\\S\\s]*?)<\/script>/g, '');
},
isJSON: function(obj){
obj = obj.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(obj);
},
encodeHTML: function(str){
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
},
decodeHTML: function(str){
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
},
toCamel: function(property){
if (!patterns.HYPHEN.test(property)) {
return property;
}
if (propertyCache[property]) {
return propertyCache[property];
}
var converted = property;
while (patterns.HYPHEN.exec(converted)) {
converted = converted.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase());
}
propertyCache[property] = converted;
return converted;
},
Cookie: {
set: function(g, c, f, b){
var e = new Date();
var a = new Date();
if (f == null || f == 0) {
f = 1;
}
a.setTime(e.getTime() + 3600000 * 24 * f);
D.cookie = g + '=' + encodeURI(c) + ';expires=' + a.toGMTString() + ';domain=' + b + '; path=/';
},
get: function(e){
var b = D.cookie;
var d = e + '=';
var c = b.indexOf('; ' + d);
if (c == -1) {
c =
mirage1982
- 粉丝: 59
- 资源: 1049
最新资源
- STM32参考资料文档应用文档UIP协议的中文介绍
- STM32参考资料文档应用文档uip1.0
- STM32参考资料文档应用文档STM32中文参考手册-V10
- STM32参考资料文档应用文档STM32中断优先级相关概念与使用笔记
- Delphi XE10.3 FMX 画图程序资源文件介绍
- STM32参考资料文档应用文档STM32在马达控制中的应用
- MapWinGIS.ocx is a FREE and OPEN SOURCE C++ based geographic inf
- 串口下载程序(适合于51 stm32单片机)
- STM32参考资料文档图片解码基于S3C44B0X的JPEG图像解码及LCD显示的实现
- STM32参考资料文档图片解码基于LPC2292的手持JPEG图像显示器设计
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈