javascript类功能代码集

ContractedBlock.gif ExpandedBlockStart.gif Code
/*
功能:鼠标放置不同DIV时显示不同的底色/底图,并还原先前图
lastDiv上一次作用的对象
initClass非作用对象的样式表
currentClass当前作用对象的样式表
lastContentDiv上一次作用对象对应的内容
*/
var _DivBgChange = function(lastDiv,initClass,currentClass,lastContentDiv){
 
this.init = initClass;
 
this.current = currentClass;
 
this.lastDiv = lastDiv;
 
this.lastContentDiv = lastContentDiv;
}
_DivBgChange.prototype 
= {
/*二种形式相互变换*/
 OverA : 
function(currentDiv,currentContentDiv){
  MM_findObj(
this.lastDiv).className = this.init;
  MM_findObj(
this.lastContentDiv).style.display = "none";
  MM_findObj(currentDiv).className 
= this.current;
  MM_findObj(currentContentDiv).style.display 
= "";
  
this.lastDiv = currentDiv;
  
this.lastContentDiv = currentContentDiv;
 },
/*四种形式相互变换*/
 OverB : 
function(currentDiv,otherDiv,currentContentDiv,currentImg,otherImg){  
  MM_findObj(currentDiv).style.background 
= "url(" + currentImg + ")";
  MM_findObj(
this.lastContentDiv).style.display = "none";
  MM_findObj(otherDiv).style.background 
= "url(" + otherImg + ")";
  MM_findObj(currentContentDiv).style.display 
= "";
  
this.lastDiv = currentDiv;
  
this.lastContentDiv = currentContentDiv; 
 }
}
ContractedBlock.gif ExpandedBlockStart.gif Code
/*
功能:动态广告
*/
var _Ad1 = function(W,H){
    
this.browser = window.ActiveXObject ? "IE" : "OTHER";
    
this.focus_width = W;
    
this.focus_height = H;
    
this.text_height = 0;
    
this.swf_height = this.focus_height + this.text_height;        
    
this.texts = "";
    
this.pics = "";
    
this.links = "";
}
_Ad1.prototype 
= {
    AdShow : 
function(X){
        
var xmlDoc = loadXML("/editor/xml/" + X + ".xml");
        
var root = xmlDoc.getElementsByTagName("NewDataSet")[0];
        
var tables = root.getElementsByTagName("table");
        
var EndStr = "";        
        
for(var i = 0;i < tables.length;i++)
        {
            i 
== tables.length-1 ? EndStr = "" : EndStr = "|";
            
if(this.browser == "IE")
            {
                
this.pics += tables[i].childNodes[0].firstChild.nodeValue + EndStr;
                
this.links += tables[i].childNodes[1].firstChild.nodeValue + EndStr;
            }
            
else
            {
                
this.pics += tables[i].childNodes[1].firstChild.nodeValue + EndStr;
                
this.links += tables[i].childNodes[3].firstChild.nodeValue + EndStr;
            }
        }
        document.write(
'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ this.focus_width +'" height="'+ this.swf_height +'">');
        document.write(
'<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="/ad/focus.swf"> <param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
        document.write(
'<param name="menu" value="false"><param name=wmode value="opaque">');
        document.write(
'<param name="FlashVars" value="pics='+this.pics+'&links='+this.links+'&texts='+this.texts+'&borderwidth='+this.focus_width+'&borderheight='+this.focus_height+'&textheight='+this.text_height+'">');
        document.write(
'<embed src="/ad/focus.swf" wmode="opaque" FlashVars="pics='+this.pics+'&links='+this.links+'&texts='+this.texts+'&borderwidth='+this.focus_width+'&borderheight='+this.focus_height+'&textheight='+this.text_height+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ this.focus_width +'" height="'+ this.swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'); 
        document.write(
'</object>');
    }
}

转载于:https://www.cnblogs.com/jone_linux/archive/2009/09/16/1567824.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值