前天见到sin100看到的那个日本网站的滚动,挖掘后原来是使用Ajax读取xml后显示出来的。
就弄了这个滚动经典最新话题的供朋友参考参考。
范例使用了prototype.js的ajax轻便型框架。
因为远程调用了 prototype.js 这个文件,测试的朋友请耐心等候一下下。
经典不允许远程调用别的站点的js文件,所以还请多一部操作,复制到本地运行查看结果。
复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="gb2312" >
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta name="author" content="Smiling Dolphin" />
<meta name="keywords" content="design, css, cascading, style, sheets, xhtml, graphic design, w3c, web standards, visual, display, java, javascript, c++, php, jsp, asp, py, pl" />
<meta name="description" content="my favorites language." />
<meta name="robots" content="all" />
<title>Dolphin Document</title>
<style type="text/css" title="currentStyle" media="screen">
#scroll{width:99%;height:25px;border:1px solid #2BBB00;background:#E7FFE0;overflow:hidden;}
#scrollFrame,#scrollFrame2{line-height:25px;font-size:13px; word-break:keep-all;line-break:normal; white-space:nowrap;}
#scrollFrame span,#scrollFrame2 span{display:inline;margin-right:20px;}
</style>
<script src="/UploadFiles/2021-04-02/prototype-1.4.0.js"></head>
<body>
<div id="scroll">
<div id="scrollFrame"></div>
<div id="scrollFrame2"></div>
</div>
<script language="javascript" type="text/javascript">
var Ticker = Class.create();
Ticker.prototype = {
initialize: function() {
try{
this.scrollType = "normal";
this.m_scroll = $(arguments[0]);
this.m_scroll_1 = $(arguments[1]);
this.m_scroll_2 = $(arguments[2]);
this.m_speed = (arguments[3][0])?arguments[3][0]:3;
this.m_request = (arguments[3][1])?arguments[3][1]:60;
this.m_loop = (arguments[3][2])?arguments[3][2]:0.05;
this.m_url = (arguments[3][3])?arguments[3][3]:'http://bbs.blueidea.com/rss.php?fid=1';
}catch(e){}
finally{}
Event.observe(this.m_scroll, 'mouseover', this.mouseover.bindAsEventListener(this), false);
Event.observe(this.m_scroll, 'mouseout', this.mouseout.bindAsEventListener(this), false);
new PeriodicalExecuter(this.scroll.bindAsEventListener(this), this.m_loop);
new PeriodicalExecuter(this.load.bindAsEventListener(this), this.m_request);
this.load();
},
load:function(){
var request = new Ajax.Request(
this.m_url,
{
method: 'post',
onSuccess: this.update.bindAsEventListener(this),
onFailure: false,
on304: false
}
);
},
update:function(request){
var items = request.responseXML.getElementsByTagName("item");
for(var i=0;i<items.length;i++){
var title = items[i].childNodes[0].childNodes[0].nodeValue;
var link = items[i].childNodes[1].childNodes[0].nodeValue;
var description = items[i].childNodes[2].childNodes[0].nodeValue;
var author = items[i].childNodes[4].childNodes[0].nodeValue;
this.m_scroll_1.innerHTML += "<span><a href=\""+link+"\" title=\""+author+":\r\n"+description+"\">"+i+":"+title+"</a></span>";
}
this.m_scroll_2.innerHTML = this.m_scroll_1.innerHTML;
},
scroll:function(event){
switch(this.scrollType){
case "slow":
if(this.m_scroll_2.offsetWidth-this.m_scroll.scrollLeft<=0){
this.m_scroll.scrollLeft -= this.m_scroll_1.offsetWidth;
}else{
this.m_scroll.scrollLeft++;
}
break;
case "normal":
default:
if(this.m_scroll_2.offsetWidth-this.m_scroll.scrollLeft<=0){
this.m_scroll.scrollLeft -= this.m_scroll_1.offsetWidth;
}else{
this.m_scroll.scrollLeft+=3;
}
break;
}
},
mouseover:function(){
this.scrollType = 'slow';
return false;
},
mouseout:function(){
this.scrollType = 'normal';
return false;
}
}
ticker1 = new Ticker("scroll","scrollFrame","scrollFrame2",[3,60,0.05,'http://bbs.blueidea.com/rss.php?fid=1']);
</script>
</body>
</html>
就弄了这个滚动经典最新话题的供朋友参考参考。
范例使用了prototype.js的ajax轻便型框架。
因为远程调用了 prototype.js 这个文件,测试的朋友请耐心等候一下下。
经典不允许远程调用别的站点的js文件,所以还请多一部操作,复制到本地运行查看结果。
复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="gb2312" >
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta name="author" content="Smiling Dolphin" />
<meta name="keywords" content="design, css, cascading, style, sheets, xhtml, graphic design, w3c, web standards, visual, display, java, javascript, c++, php, jsp, asp, py, pl" />
<meta name="description" content="my favorites language." />
<meta name="robots" content="all" />
<title>Dolphin Document</title>
<style type="text/css" title="currentStyle" media="screen">
#scroll{width:99%;height:25px;border:1px solid #2BBB00;background:#E7FFE0;overflow:hidden;}
#scrollFrame,#scrollFrame2{line-height:25px;font-size:13px; word-break:keep-all;line-break:normal; white-space:nowrap;}
#scrollFrame span,#scrollFrame2 span{display:inline;margin-right:20px;}
</style>
<script src="/UploadFiles/2021-04-02/prototype-1.4.0.js"></head>
<body>
<div id="scroll">
<div id="scrollFrame"></div>
<div id="scrollFrame2"></div>
</div>
<script language="javascript" type="text/javascript">
var Ticker = Class.create();
Ticker.prototype = {
initialize: function() {
try{
this.scrollType = "normal";
this.m_scroll = $(arguments[0]);
this.m_scroll_1 = $(arguments[1]);
this.m_scroll_2 = $(arguments[2]);
this.m_speed = (arguments[3][0])?arguments[3][0]:3;
this.m_request = (arguments[3][1])?arguments[3][1]:60;
this.m_loop = (arguments[3][2])?arguments[3][2]:0.05;
this.m_url = (arguments[3][3])?arguments[3][3]:'http://bbs.blueidea.com/rss.php?fid=1';
}catch(e){}
finally{}
Event.observe(this.m_scroll, 'mouseover', this.mouseover.bindAsEventListener(this), false);
Event.observe(this.m_scroll, 'mouseout', this.mouseout.bindAsEventListener(this), false);
new PeriodicalExecuter(this.scroll.bindAsEventListener(this), this.m_loop);
new PeriodicalExecuter(this.load.bindAsEventListener(this), this.m_request);
this.load();
},
load:function(){
var request = new Ajax.Request(
this.m_url,
{
method: 'post',
onSuccess: this.update.bindAsEventListener(this),
onFailure: false,
on304: false
}
);
},
update:function(request){
var items = request.responseXML.getElementsByTagName("item");
for(var i=0;i<items.length;i++){
var title = items[i].childNodes[0].childNodes[0].nodeValue;
var link = items[i].childNodes[1].childNodes[0].nodeValue;
var description = items[i].childNodes[2].childNodes[0].nodeValue;
var author = items[i].childNodes[4].childNodes[0].nodeValue;
this.m_scroll_1.innerHTML += "<span><a href=\""+link+"\" title=\""+author+":\r\n"+description+"\">"+i+":"+title+"</a></span>";
}
this.m_scroll_2.innerHTML = this.m_scroll_1.innerHTML;
},
scroll:function(event){
switch(this.scrollType){
case "slow":
if(this.m_scroll_2.offsetWidth-this.m_scroll.scrollLeft<=0){
this.m_scroll.scrollLeft -= this.m_scroll_1.offsetWidth;
}else{
this.m_scroll.scrollLeft++;
}
break;
case "normal":
default:
if(this.m_scroll_2.offsetWidth-this.m_scroll.scrollLeft<=0){
this.m_scroll.scrollLeft -= this.m_scroll_1.offsetWidth;
}else{
this.m_scroll.scrollLeft+=3;
}
break;
}
},
mouseover:function(){
this.scrollType = 'slow';
return false;
},
mouseout:function(){
this.scrollType = 'normal';
return false;
}
}
ticker1 = new Ticker("scroll","scrollFrame","scrollFrame2",[3,60,0.05,'http://bbs.blueidea.com/rss.php?fid=1']);
</script>
</body>
</html>
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月30日
2024年11月30日
- 黑鸭子2006-樱桃女声[首版][WAV+CUE]
- 颜人中《这是一张情歌专辑》[FLAC/分轨][258.76MB]
- 华晨宇《华晨宇日出演唱会特辑》[320K/MP3][101.77MB]
- 华晨宇《华晨宇日出演唱会特辑》[Hi-Res][24bit 48kHz][FLAC/分轨][941.13MB]
- 刘俊麟 《美妙!我被五小只包围了》[320K/MP3][86.74MB]
- 刘俊麟 《美妙!我被五小只包围了》[FLAC/分轨][454.29MB]
- 群星《错位 影视原声带》[320K/MP3][63.65MB]
- 中国音乐地图之听见四川彝族民间歌曲乐曲集2020[WAV+分轨]
- 姚璎格《姚璎格的歌(24K纯金CD)》[正版原抓WAV+CUE]
- 高垣彩陽《melodia4》【Hi-Res】24bit-96kHz【flac】
- 王菀之《The Missing Something》[320K/MP3][67.2MB]
- 赵翊帆《LUNARFACE》[320K/MP3][88.81MB]
- 赵翊帆《LUNARFACE》[FLAC/分轨][464.62MB]
- 小野丽莎《OnoLisabest1997-2001》日本醇选辑[正版原抓WAV+CUE]
- 天籁之音NanaMouskouri《AtHerVeryBest》K2HD[正版原抓WAV+CUE]