[重要通告]如您遇疑難雜癥,本站支持知識付費業(yè)務,掃右邊二維碼加博主微信,可節(jié)省您寶貴時間哦!

/*<pre>
MyW3 Js Tools Kit 1.0

更新說明:
1.Swf添加了透明支持
2.增加了_Get對象
3.增加了修改Class函數(shù)

函數(shù):_Swf(s,w,h,d,i)
功能:加載SWF文件;
用法:_Swf(Flash文件名,寬,高,文件背景是否透明,FlashURI);
寬高:可以是數(shù)字,也可以為站父對象的百分比(如:100%),可以省略,默認100%;
文件背景是否透明:1為透明,其他未不透明,可以省略,默認透明;
FlashURI:Flash默認的保存路徑,可以省略,默認未myw3_res指定的路徑;

函數(shù):_Get(o,t,p)
功能:獲取DOM對象;
用法:_Get(對象標識,標識類型,父對象);
對象標識:根據(jù)標識類型根據(jù)對象標識獲取對象;
標識類型:id、tagname、name,可以省略,默認id;
父對象:可以省略,默認documet;

函數(shù):o.Class.add(classname),o.Class.get(),o.Class.remove(classname)
功能:添加/刪除/查看對象的ClassName
用法:_Class(對象).add(Class名稱),_Class(對象).get(),_Class(對象).remove(Class名稱)

請尊重作者的勞動成果,保存下面的版權連接
版權所有:<a href="http://myw3.cn/">MyW3</a>
</pre>*/
var myw3=new myw3sys();
var myw3_res="/Js/resource/";                //資源文件的默認路徑

function myw3sys(){
        this.cn=new function(){
                this.ver="1.00.0710";
                this.sid="80710"
                this.home=new function(){
                        this.name="MyW3 Js Tools Kit"
                        this.url="http://labs.myw3.cn/js/resource/myw3sys.js"
                        this.homesite="http://labs.myw3.cn/js/myw3sys/"
                        this.GoHome=function(){location.href=this.homesite;}
                        this.Download=function(){location.href=this.url;}
                        return this.url;
                }
        }
        this.cn_class=new function(){
                var q=(window.ActiveXObject)?"className":"class";
                this.q=q;
                this.add=function(c){
                        if(this.get()&&this.get()!="undefined"){
                                if(this.get().indexOf(c)==-1)
                                        tmp=this.get()+" "+c;
                        }else{
                                tmp=c;
                        }
                        po.setAttribute(q,tmp);
                }
                this.remove=function(c){
                        if(this.get()){
                                var tmp=this.get();
                                tmp=tmp.replace(" "+c,"");
                                tmp=tmp.replace(c+" ","");
                                if(this.get().indexOf(" ")==-1){tmp=tmp.replace(c,"");}
                        }
                        po.setAttribute(q,tmp);
                }
                this.get=function(){
                        return po.getAttribute(q);
                }
        }
        this.cn_swf=function(s,w,h,d,i){
                s=s.replace("fla","swf");
                if(!w)
                        w="100%";
                if(!h)
                        h="100%";
                if(!d)
                        d=1;
                        //d==0?transparent:Opaque;
                if(!i)
                        //默認的FlashURI
                        i=myw3_res;
                d=d==1?"transparent":"Opaque";
                document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"  width="'+w+'" height="'+h+'" />');
                document.writeln('<param name="movie" value="'+i+s+'" />');
                document.writeln('<param name="quality" value="high" />');
                document.writeln('<param name="wmode" value="'+d+'" />');
                document.writeln('<embed src="'+i+s+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" wmode="'+d+'">');
                document.writeln('</embed></object>');
        }
        this.cn_get=function(o,t,p){
                if(!p)
                p=document;
                switch(t){
                        case "name":po=p.getElementsByName(o);break;
                        case "tagname":po=p.getElementsByTagName(o);break;
                        default:po=document.getElementById(o);break;
                }
                po.Class=new _Class;
                return po;
        }
}
//_Class請勿修改,否則導致程序不正常
function _Class(){
        return myw3.cn_class;
}

function _Swf(s,w,h,d,i){
        myw3.cn_swf(s,w,h,d,i);
}

//兼容Beta1.0版本的myw3_swf
function myw3_swf(s,w,h,i){
        myw3.cn_swf(s,w,h,1,i);
}

function _Get(o,t,p){
        return myw3.cn_get(o,t,p);
}

function _Help(){
        myw3.cn.home.GoHome();
}

問題未解決?付費解決問題加Q或微信 2589053300 (即Q號又微信號)右上方掃一掃可加博主微信

所寫所說,是心之所感,思之所悟,行之所得;文當無敷衍,落筆求簡潔。 以所舍,求所獲;有所依,方所成!

支付寶贊助
微信贊助

免責聲明,若由于商用引起版權糾紛,一切責任均由使用者承擔。

您必須遵守我們的協(xié)議,如您下載該資源,行為將被視為對《免責聲明》全部內容的認可->聯(lián)系老梁投訴資源
LaoLiang.Net部分資源來自互聯(lián)網(wǎng)收集,僅供用于學習和交流,請勿用于商業(yè)用途。如有侵權、不妥之處,請聯(lián)系站長并出示版權證明以便刪除。 敬請諒解! 侵權刪帖/違法舉報/投稿等事物聯(lián)系郵箱:service@laoliang.net
意在交流學習,歡迎贊賞評論,如有謬誤,請聯(lián)系指正;轉載請注明出處: » 一個JS封裝類

發(fā)表回復

本站承接,網(wǎng)站推廣(SEM,SEO);軟件安裝與調試;服務器或網(wǎng)絡推薦及配置;APP開發(fā)與維護;網(wǎng)站開發(fā)修改及維護; 各財務軟件安裝調試及注冊服務(金蝶,用友,管家婆,速達,星宇等);同時也有客戶管理系統(tǒng),人力資源,超市POS,醫(yī)藥管理等;

立即查看 了解詳情