用JObj实现的渐变效果
我们 www.jb51.net>
(function($){
$.isPercent = function(p){
return /^(\d*)(\.?)(\d*)%$/.test(p);
}
var __alert__ = $.alert;
$.alert = function(){
var arg,s="";
for(var i=0;arg = arguments[i];i++){
s += arg + "\n"
}
__alert__(s);
}
})(window);
String.prototype.trim = function(){
return this.replace(/(^\s*)|(\s*$)/g, "");
}
var JObj = {};
(function($){
/*----------------------------------------------------------------------------
Config
Private
----------------------------------------------------------------------------*/
var Config = {};
(function($){
$.Const = {};
$.Path = {};
$.loadedModule = {};
})(Config)
$.$getConfigConst = function(){
return Config.Const;
}
$.$getConfigPath = function(){
return Config.Path;
}
$.$getConfigLoaded = function(){
return Config.LoadedModule;
}
/*----------------------------------------------------------------------------
Error
JObj.Error
----------------------------------------------------------------------------*/
$.Error = {};
(function($){
$.debug = true;
var ErrorList = {};
$.$pushError = function(msg,e){
}
})($.Error)
/*----------------------------------------------------------------------------
Dom operater
JObj.Dom Object
----------------------------------------------------------------------------*/
var DomObj = function(){
var $ = this;
var object;
$.$setHTMLObject = function(p){
object = p;
//alert($.$setHTMLObject.caller);
}
$.$getHTMLObject = function(){
return object;
}
$.$appendTo = function(p){
f = JObj.Dom.$(p,false) || document.body;
f.appendChild(object);
return $;
}
$.$attr = function(k,v){
object.setAttribute(k,v);
object[k] = v;
return $;
}
$.$attrs = function(rule){
var k;
for(k in rule){
$.$attr(k,rule[k]);
}
return $;
}
$.$css = function(k,v){
object.style[k] = v;
return $;
}
$.$csss = function(rule){
var k;
for(k in rule)
$.$css(k,rule[k]);
return $;
}
}
$.Dom = {};
(function($,$$){
var domObj = new DomObj();
$.$ = function(p,f){
var o = typeof(p) == "object" ? p : document.getElementById(p);
if(f !== false){
domObj.$setHTMLObject(o);
return domObj;
}else return o;
}
$.$tag = function(p){
return o = document.getElementsByTagName(p);
}
$.$c = function(p,n){
var o;
try{
if(n) o = document.createElemnet("");
else o = document.createElement(p);
}catch(e){
o = document.createElement(p);
o.name = name;
}
domObj.$setHTMLObject(o);
return domObj;
}
})($.Dom,$)
/*----------------------------------------------------------------------------------
Browser check
JObj.Browser Object
----------------------------------------------------------------------------------*/
$.Browser = {};
(function($){
var $fv = function(){
var f="-1",n=navigator;
if (n.plugins && n.plugins.length) {
for (var ii=0;ii=2;ii--) {
try {
var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");
if (fl) { f=ii + '.0'; break; }
}catch(e) {}
}
}
if(f == "-1") return f;
else return f.substring(0,f.indexOf(".")+2)
}
//Notice : Firefox ,NS can't use property: name (case sensitive)! Because it's a hold field ,and it's values is anonymous.
var n_ = navigator,s_ = screen;
var b = n_.appName;
var ua = n_.userAgent.toLowerCase();
$.name = "Unknow";
$.safari = ua.indexOf("safari")>-1; // always check for safari & opera
$.opera = ua.indexOf("opera")>-1; // before ns or ie
$.firefox = ua.indexOf('firefox')>-1; // check for gecko engine
$.ns = !$.firefox && !$.opera && !$.safari && (b=="Netscape");
$.ie = !$.opera && (b=="Microsoft Internet Explorer");
$.name = ($.ie ? "IE" : ($.firefox ? "Firefox" : ($.ns ? "Netscape" : ($.opera ? "Opera" : ($.safari ? "Safari" : "Unknow")))));
switch($.name){
case "Opera":
$.fullVersion = ua.substr(ua.indexOf("opera") + 6);
break;
case "IE":
$.fullVersion = ua.substr(ua.indexOf("msie") + 5).split(";")[0];
break;
case "Firefox":
$.fullVersion = ua.substr(ua.indexOf("firefox") + 8);
break;
case "Safari":
$.fullVersion = ua.substr(ua.indexOf("version") + 8).split(" ")[0];
break;
case "Netscape":
$.fullVersion = ua.substr(ua.indexOf("netscape") + 9);
break;
default:
$.fullVersion = "-1";
}
$.version = parseFloat($.fullVersion);
$.flashVersion = $fv();
$.cookieEnabled = n_.cookieEnabled;
$.javaEnabled = n_.javaEnabled();
})($.Browser);
/*----------------------------------------------------------------------------------
Cookie Operate
JObj.Cookie Object
----------------------------------------------------------------------------------*/
$.Cookie = {};
(function($){
$.$get = function(){
var cookies = document.cookie;
if (cookies == "") return;
cookies = cookies.split(';');
for(var i=0; i
for(var i=0;i
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]