Home > Web Front-end > JS Tutorial > JObj previews a JS framework_js object-oriented

JObj previews a JS framework_js object-oriented

WBOY
Release: 2016-05-16 19:05:54
Original
1109 people have browsed it

I don’t have much time, so I write most of it after work.

Copy code The code is as follows:

JObj.Dom.$tag("INPUT") 
  .$filter(function(o){    
   var fa = o.parentNode.parentNode.parentNode; 
   return f =(o.type == "text" && fa.id == "hollerNew") ? true : false; 
  }) 
  .$css({width:"570px",height:"18px",lineHeight:"18px"}) 
  .$attr({className:"hollerFormNormal"}) 
  .$event({ 
   onfocus:"vControl('TEXTFOCUS',this)", 
   onblur:"vControl('TEXTBLUR',this)" 
   }) 
  .$tag("TEXTAREA") 
  .$css({width:"570px",height:"100px",lineHeight:"18px"}) 
  .$attr({className:"hollerFormNormal"}) 
  .$event({ 
   onfocus:"vControl('TEXTFOCUS',this)", 
   onblur:"vControl('TEXTBLUR',this)" 
   }) 
  .$(document.hollerNew) 
    .$event({ 
     onsubmit:function(){ 
      return JObj.FormValidate.$validate(this,rules); 
     } 
    }); 

JObj.Dom.$(window) 
  .$event({ 
   onscroll:"vControl('FIXTOOLBAR')" 
  }); 

var vControl = function(pChoice){ 
 var args = arguments; 
 switch(pChoice){ 
  case "BACKER": 
   var backer = args[1]; 
   var id = args[2]; 
   break; 
  case "FLOWERS": 
   var id = args[1]; 
   break; 
  case "EGGS": 
   var id = args[1]; 
   break; 
  case "TEXTFOCUS": 
   args[1].className = "hollerFormFocus"; 
   break; 
  case "TEXTBLUR": 
   args[1].className = "hollerFormNormal"; 
   break; 
  case "SHOWTIP": 
   var o,t; 
   switch(args[3]){ 
    case "FLOWER":  
     o = "hollerTip_flower_"; 
     t = "鲜花 "   args[2]   " 朵,送他/她一朵,让她开花店!" 
     break; 
    case "EGG":  
     o = "hollerTip_egg_"; 
     t = "鸡蛋 "   args[2]   " 枚,如果你怕不够孵小鸡,你在给他/她一枚!" 
     break; 
    default :  
     return; 
   } 

   JObj.Dom.$(o   args[1]) 
     .$attr({innerHTML:t}) 
     .$css({display:"",position:"relative"}) 
     .$show("fast", 
      {width:0,height:0}, 
      {width:400,height:18}  
     ); 
   break; 
  case "HIDETIP": 
   var o; 
   switch(args[2]){ 
    case "FLOWER": o = "hollerTip_flower_";break; 
    case "EGG": o = "hollerTip_egg_";break; 
    default : return; 
   }   

   JObj.Dom.$(o   args[1]) 
     .$hide("fast"); 
   break; 
  case "FIXTOOLBAR": 
   JObj.Dom.$("toolBar") 
     .$css({opacity:0.1,filter:"Alpha(Opacity=10)"}) 
     .$moveToScrollTop("fast"); 
   break; 
 } 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template