富贵资源网 Design By www.hznty.com
复制代码 代码如下:
/*
 *YYJ.js 主要提供后台应用方法
 *目前有Ajax、addLoadEvent、deleteAll、getByClass、$C(=getByClass)、$、yyjtable、setCss、getCss、iaArray等方法。最后面还提供了一个
 *可实例化的方法YYJ.tick用来计算脚本运行时间
 *版本0.1    --tianyi    yyj
 */
 var YYJ=function(){
     var UniqueInstance;
     function constrotor(){
         return {
             //ajax方法
             Ajax:function(method,url,data,success,fail){
                 var isget=method.toLowerCase()=="get";
                 var xmlhttp=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");
                 xmlhttp.open(method,url,true);
                 if(!isget)xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
                 xmlhttp.onreadystatechange=function(){
                         if(xmlhttp.readyState==4){
                             if(xmlhttp.status==200){
                                 if(success)success(xmlhttp);
                             }else{
                                 if(fail)fail(xmlhttp);
                             }
                         }
                 };
                 xmlhttp.send(isget?null:data);
             },//Ajax
             addLoadEvent:function(func) {
                 var oldonload = window.onload;
                 if (typeof window.onload != 'function') {
                     window.onload = func;
                 } else {
                     window.onload = function() {
                       if (oldonload) {
                         oldonload();
                       }
                       func();
                     }
                 }
             },//addLoadEvent
             deleteAll:function(checkallbtn,checksomebtn,submitbtn){
                 var checkall=YYJ.$(checkallbtn);
                 var checksome=YYJ.$(checksomebtn);
                 var submit1=YYJ.$(submitbtn);
                 var checkboxs=(function(){
                     var arr=[];
                     var check=document.getElementsByTagName("input");
                     for(i=0;i<check.length;i++){
                         if(check[i].getAttribute("type")!="checkbox")
                             continue;
                         arr.push(check[i]);
                     }
                     return arr;
                 })();
                 checkall.onclick=function(){
                     checkall.clicked=true;
                     for(var i=0;i<checkboxs.length;i++){
                         if(!checkboxs[i].checked){
                             checkall.clicked=false;
                             break;
                         }
                     }
                     if(!checkall.clicked){
                         for(var i=0;i<checkboxs.length;i++){
                             checkboxs[i].checked=true;
                         }
                     }else{
                         for(var i=0;i<checkboxs.length;i++){
                             checkboxs[i].checked=false;
                         }
                     }
                 }
                 checksome.onclick=function(){
                     for(var x in checkboxs){
                         checkboxs[x].checked=!checkboxs[x].checked;
                     }
                 }
                 submit1.onclick=function(){
                     var haschecked=false;
                     var beSureDel=false;
                     for(var i=0;i<checkboxs.length;i++){
                         if(checkboxs[i].checked){
                             haschecked=true;
                             break;
                         }
                     }
                     haschecked?function(){
                         beSureDel=confirm("确定要删除选中项吗?");
                     }():function(){
                         alert("没有选中项!");
                         beSureDel=false;
                     }();
                     return beSureDel;
                 }
             },//deleteall
             getByClass:function(classname,parent,nodename){
                 var s=(parent||document).getElementsByTagName(nodename||"*");
                 return function(){
                     var a=[];
                     for(var i=0,j=s.length;i<j;i++){
                         if(!s[i].className) continue;
                         var name=" "+s[i].className+" ";
                         if(name.indexOf(" "+classname+" ")!=-1){
                             a.push(s[i]);
                         }
                     }
                     return a;
                 }();
             },
             $C:function(classname,parent,nodename){
                 return YYJ.getByClass(classname,parent,nodename);
             },//getByClass
             $:function(str){
                 return document.getElementById(str);
             },//getById
             yyjtable:function(tableId){
                 var tbl=YYJ.$(tableId);
                 var trs=tbl.getElementsByTagName("tr");
                 for(var i=1;i<trs.length;i++){
                     if(i%2!=0){
                         trs[i].style.backgroundColor="#FFFFF0";
                     }else{
                         trs[i].style.backgroundColor="white";
                     }
                     trs[i].onmouseover=function(){
                         this.col1=this.style.backgroundColor;
                         this.style.backgroundColor="#FFFACD";
                     }
                     trs[i].onmouseout=function(){
                         this.style.backgroundColor=this.col1;
                     }
                 }
             },//yyjtable
             /*使用方法
             YYJ.setCss([YYJ.$("table1")],{
                 color:"red",
                 backgroundColor:"silver"
             });*/
             setCss:function(eles,opt){
                 if(!eles||!opt)return;
                 if(!eles.length){
                     throw new Error("setCss的第一个参数要求为数组!");
                 }
                 for(var i=0;j=eles[i];i++){
                     try{
                         for(var x in opt){
                             j.style[x]=opt[x];
                         }
                     }catch(ex){}
                 }
             },//setCss
             /*使用方法
             var css=YYJ.getCss(YYJ.$("table1"),["backgroundColor"]);
             alert(css["backgroundColor"]);*/
             getCss:function(ele,opt){
                 if(!this.isArray(opt)){
                     throw new Error("getCss的第二个参数要求为string数组!");
                 }
                 var css={};
                 for(var i=0,j=opt.length;i<j;i++){
                     try{
                         css[opt[i]]=ele.style[opt[i]];
                     }catch(ex){}
                 }
                 return css;

             },//getCss
             isArray:function(opt){
                 return Object.prototype.toString.call(opt)=="[object Array]"
             }

         };
     }
     function getUniqueInstance(){
         if(UniqueInstance){
             return UniqueInstance;
         }
         UniqueInstance=constrotor();
         return UniqueInstance;
     }
     return getUniqueInstance();
 }();
 //脚本执行时间
 /*使用方法
 var ti=new YYJ.ticks();
 ti.begin();
 代码段
 ti.end();
 alert(ti.tick);*/
 YYJ.ticks=function(){
     var starttick,stoptick;
     return function(){
         this.begin=function(){
             starttick=new Date();
         }
         this.end=function(){
             stoptick=new Date();
             this.tick=stoptick-starttick;
         }
     }
 }();
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。