今天晚上搞了一下金融界这个模版
一些特效和框架没有问题,就是调用信息方面出现了疑问
http://jrj.com.cn/
<DIV class=cr2 id=l1_2>
<UL class=title2 id=u1_2>
<LI id=l1_2_1><A class=sel>要闻</A> </LI>
<LI id=l1_2_2><A href="">市场</A> </LI>
<LI id=l1_2_3><A href="">爱股</A> </LI>
<LI class=last id=l1_2_4><A href="">爱基</A> </LI></UL>
<DIV class=showblock id=l1_2_b_1>
11111
</DIV>
<DIV class=hiddenblock id=l1_2_b_1>
22222222
</DIV>
这样无法加载第2条信息,加载的都是第一条,本来想用自己的方法调用,但考虑到使用的范围太广,要写很多代码,
</DIV>
这是金融界加载的一个JS-
- var POSL="1,2,3,5,6,7,8,9,10";
- var POSC = "1,2,3";
- var ArrPos = new Array(1,2,3,4,5,6,7,8,9,10);
- //记录拖动后的cookie
- function SetPos(para,key)
- {
- pos=new HttpCookie("pos");
- var keys = key + "[[]]=";
- var pattern = new RegExp(keys,"g");
- var paras = para.replace(pattern,"");
- pattern = new RegExp("\&","g");
- paras = paras.replace(pattern,",");
- var cl = key.substr(key.lastIndexOf('_')+1);
- var pos_line2=pos.values.get("line");
- if(pos_line2==null||pos_line2==""||pos_line2.length!=POSL.length)
- {
- pos_line2 = POSL;
- }
- var posArr = pos_line2.split(",");
- var keyp = "l_"+posArr[cl-1];
- pos.values.set(keyp,paras);
- pos.setExpires(356*24*60*60);
- pos.save();
- }
- //交换节点
- function ChangeNode(n1,n2)
- {
- var id1=n1.id;
- var id2=n2.id;
- var f = n1.parentNode;
- var n2copy = n2.cloneNode(true);
- var ni1 = f.insertBefore(n2copy,n2);
- var ni2 = f.insertBefore(n2,n1);
- var nr = f.replaceChild(n1,n2copy);
- var pos1 = id1.substr(id1.lastIndexOf('_')+1);
- var pos2 = id2.substr(id2.lastIndexOf('_')+1);
- SetLinePos(pos1,pos2);
- }
- //记录交换后行的位置
- function SetLinePos(pos1,pos2)
- {
- pos=new HttpCookie("pos");
- var pos_line2=pos.values.get("line");
- if(pos_line2==null||pos_line2==""||pos_line2.length!=POSL.length)
- {
- pos_line2 = POSL;
- }
- var posArr = pos_line2.split(",");
- var posc1 = ArrPos[pos1-1];
- var posc2 = ArrPos[pos2-1];
- var t = posArr[posc1-1];
- posArr[posc1-1] = posArr[posc2-1];
- posArr[posc2-1] = t;
- ArrPos[pos1-1] = posc2;
- ArrPos[pos2-1] = posc1;
- var newpos = "";
- for(var j=0;j<posArr.length;j++)
- {
- newpos = newpos+posArr[j]+",";
- }
- newpos = newpos.substr(0,newpos.length-1);
- var pos=new HttpCookie("pos");
- pos.values.set("line",newpos);
- pos.setExpires(356*24*60*60);
- pos.save();
- }
- //鼠标移动切换
- var MouseDelayTime=200;
- var waitInterval;
- var tempref;
- var arrCon=new Object();
- var temppare;
- function InitPage()
- {
- for(var j=0;j<ARGUMENTS.LENGTH;J++)
- {
- var ulobj=$(arguments[j]);
- var ulist = ulobj.getElementsByTagName("li");
- for (var i=0,len=ulist.length;i<LEN;++I)
- {
- var thelist = ulist;
- var thetitleA = thelist.getElementsByTagName("a")[0];
- thelist.setActive=function(bactive){
- temppare = this.parentNode.parentNode;
- var thelistA = this.getElementsByTagName("a")[0];
- if(bactive){
- this.status="active";
- this.className=this.className + ' rel';
- thelistA.className=thelistA.className + ' sel';
- temppare.activetab=this;
- }else{
- this.status="normal";
- this.className=this.className.replace('rel','');
- thelistA.className=thelistA.className.replace('sel','');
- }
- };
- thelist.onmouseover=function(){
- if(this.status=="active") return;
- tempref = this;
- window.clearTimeout(waitInterval);
- waitInterval=window.setTimeout("tempref.LoadTab()",MouseDelayTime)
- };
- thelist.onmouseout=function(){
- window.clearTimeout(waitInterval);
- };
- thelist.LoadTab=function(){
- temppare = this.parentNode.parentNode;
- if(temppare.activetab != null)
- temppare.activetab.setActive(false);
- this.setActive(true);
- var theblocks = document.getElementsByClassName('showblock',temppare);
- var theblockh = document.getElementsByClassName('hiddenblock',temppare);
- if(theblockh != null && theblockh.length == 1 && theblocks != null && theblocks.length == 1)
- {
- if(Math.ceil(this.id.substr(this.id.length-1) / 3) != theblocks[0].id.substr(theblocks[0].id.length-1))
- {
- theblocks[0].className='hiddenblock';
- theblockh[0].className='showblock';
- }
- }
- LoadData(this.id,document.getElementsByClassName('showblock',temppare)[0]);
- };
- if(thetitleA.className.indexOf('sel')!=-1)
- {
- thelist.status="active";
- thelist.className=thelist.className + ' rel';
- temppare = thelist.parentNode.parentNode;
- temppare.activetab=thelist;
- arrCon[thelist.id]=document.getElementsByClassName('showblock',temppare)[0].innerHTML;
- }
- }
- }
- }
复制代码 当鼠标移动到第2个
效果可以加载,但信息无法实现
<ul class="title2" id="u1_2">
<li class="" id="l1_2_1"><a class="">要闻</a></li>
<li class="rel" id="l1_2_2"><a class="sel" href="">市场</a></li>
<li id="l1_2_3"><a href="">爱股</a></li>
<li id="l1_2_4" class="last"><a href="">爱基</a></li>
</ul>
<DIV class=showblock id=l1_2_b_1>
11111
</DIV>加载的信息还是这个
不知道金融界这个是如何实现的,???
[ 本帖最后由 yooge.net 于 2007-11-7 02:56 编辑 ] |