<?xml version="1.0" encoding="UTF-8"?>
<code>
	<JsLoader author="FS" date="" common=""><![CDATA[function JsLoader(){
    this.load = function(url, charset){
        var ss = document.getElementsByTagName("script");
        for(var i = 0;i < ss.length; i++){
            if(ss[i].src && ss[i].src.indexOf(url) != -1) {
                this.onsuccess();
                return;
            }
        }
        var s = document.createElement("script");
        s.type= "text/javascript";
        s.src = url;
        s.charset = charset ? charset : "utf-8";
        alert(s.charset);
        var head = document.getElementsByTagName("head")[0];
        head.appendChild(s);

        
        var self = this;
        s.onload = s.onreadystatechange = function() {
            if(this.readyState && this.readyState == "loading")return;
            self.onsuccess();
        }
        s.onerror = function() {
            head.removeChild(s);
            self.onfailure();
        }
    };
    this.onsuccess=function(){};
    this.onfailure=function(){};
}]]></JsLoader><JsLoader author="WC" date="" common=""><![CDATA[<script type="text/javascript">
var callbackJS = function (name, charset, url, callback, errorcallback) {
	charset = charset || 'gb2312';
	
	if (/MSIE/.test(window.navigator.userAgent)) {
		var frag = document.createDocumentFragment(), script = frag.createElement('script');
		script.charset = charset;
		frag[name] = function () {
			callback.apply(null, arguments), frag = script = script.onreadystatechange = frag[name] = null;
		};
		script.onreadystatechange = function () {
			if (script.readyState == 'loaded') {
				errorcallback(), frag = script = script.onreadystatechange = frag[name] = null;
			}
		};
		script.src = url;
		frag.appendChild(script);
	} else {
		var iframe = document.createElement('iframe');
		iframe.style.display = 'none';
		
		iframe.callback = function () {
			callback.apply(null, arguments), iframe.callback = iframe.errorcallback = null;
			iframe.src = 'about:blank', iframe.parentNode.removeChild(iframe), iframe = null;
		};
		iframe.errorcallback = function () {
			errorcallback(), iframe.callback = iframe.errorcallback = null;
			iframe.src = 'about:blank', iframe.parentNode.removeChild(iframe), iframe = null;
		};
		try {
			document.body.appendChild(iframe);
			iframe.contentWindow.document.write(
				'<script type="text\/javascript">function ' + name + '() { window.frameElement.callback.apply(null, arguments); }<\/script>'
				+ '<script type="text\/javascript" src="' + url + '" charset="' + charset + '"><\/script>'
				+ '<script type="text\/javascript">window.setTimeout("try { window.frameElement.errorcallback(); } catch (exp) {}", 100)<\/script>'
			);
			iframe.contentWindow.document.close();
		} catch (exp) { }
	}
};]]></JsLoader><Browser author="qzone" date="" common=""><![CDATA[var Browser={};
Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
Browser.isIE = window.ActiveXObject ? true : false;
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);
Browser.isSafari = (navigator.userAgent.toLowerCase().indexOf("safari")!=-1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);]]></Browser><XMLDocumentprototype author="qzone" date="" common=""><![CDATA[if(Browser.isFirefox){
    XMLDocument.prototype.selectSingleNode=Element.prototype.selectSingleNode=function(xpath){
        var x=this.selectNodes(xpath)
        if(!x || x.length<1)return null;
            return x[0];
    }
    XMLDocument.prototype.selectNodes=Element.prototype.selectNodes=function(xpath){
        var xpe = new XPathEvaluator();
        var nsResolver = xpe.createNSResolver(this.ownerDocument == null ?
        this.documentElement : this.ownerDocument.documentElement);
        var result = xpe.evaluate(xpath, this, nsResolver, 0, null);
        var found = [];
        var res;
        while (res = result.iterateNext())
            found.push(res);
        return found;
    }
    XMLDocument.prototype.getOuterXML=Element.prototype.getOuterXML=function(){
        try{
            return new XMLSerializer().serializeToString(this);
        }catch(e){
            var d = document.createElement("div");
            d.appendChild(this.cloneNode(true));
            return d.innerHTML;
        }
    }
    XMLDocument.prototype.__proto__.__defineGetter__("xml",function(){
        try{
            return new XMLSerializer().serializeToString(this);
        }catch(ex){
            var d=document.createElement("div");
            d.appendChild(this.cloneNode(true));
            return d.innerHTML;
        }
    });
    Element.prototype.__proto__.__defineGetter__("xml",function(){
        try{
            return new XMLSerializer().serializeToString(this);
        }catch(ex){
            var d=document.createElement("div");
            d.appendChild(this.cloneNode(true));
            return d.innerHTML;
        }
    });
    XMLDocument.prototype.__proto__.__defineGetter__("text",function(){
        return this.firstChild.textContent
    });
    Element.prototype.__proto__.__defineGetter__("text",function(){
        return this.textContent
    });
}]]></XMLDocumentprototype><parseXML author="qzone" date="" common=""><![CDATA[function parseXML(st){
    var result = null;
    if(Browser.isIE){
        result = getXMLDOM();
        if(result) result.loadXML(st);
    }else{
        var parser = new DOMParser();
        result = parser.parseFromString(st, "text/xml");
    }
    return result;
}
]]></parseXML><getXMLDOM author="qzone" date="" common=""><![CDATA[function getXMLDOM(){
    if(!Browser.isIE) return null;
    var xmldomversions = ['MSXML2.DOMDocument.5.0', 'MSXML2.DOMDocument.4.0', 'MSXML2.DOMDocument.3.0', 'MSXML2.DOMDocument', 'Microsoft.XMLDOM'];
    for(var i=xmldomversions.length-1;i>=0;i--)
        try{
            return new ActiveXObject(xmldomversions[i]);
        }catch(e){
        }
    return document.createElement("XML");
}
]]></getXMLDOM><AjaxMethod author="dh20156" date="" common=""><![CDATA[var Try = {
	these: function(){
		var returnValue;
		for(var i=0; i<arguments.length; i++){
			var lambda = arguments[i];
			try{
				returnValue = lambda();
				break;
			}catch(e){}
		}
		return returnValue;
	}
}

function ajaxInitRV(){
	return Try.these(
	function() {return new ActiveXObject('MSXML2.XMLHttp.6.0')},
	function() {return new ActiveXObject('MSXML2.XMLHttp.3.0')},
	function() {return new XMLHttpRequest()},
	function() {return new ActiveXObject('MSXML2.XMLHttp.5.0')},
	function() {return new ActiveXObject('MSXML2.XMLHttp.4.0')},
	function() {return new ActiveXObject('Msxml2.XMLHTTP')},
	function() {return new ActiveXObject('MSXML.XMLHttp')},
	function() {return new ActiveXObject('Microsoft.XMLHTTP')}
	) || null;
}

function Post(xmlHttp, url, args, callback) {
    xmlHttp.open("POST", encodeURI(url), true);
    xmlHttp.setRequestHeader("Content-Length",args.length);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.onreadystatechange = function() { callback(xmlHttp); }
    xmlHttp.send(args);
}

function Get(xmlHttp, url, callback) {
    xmlHttp.open("GET", encodeURI(url), true);
    xmlHttp.onreadystatechange = function() { callback(xmlHttp); }
    xmlHttp.send("FOO");
}]]></AjaxMethod><trim author="" date="" common=""><![CDATA[String.prototype.trim=function(){  return this.replace(/(^\s+)|(\s+$)/g,""); }
String.prototype.ltrim=function(){  return this.replace(/^\s+/,""); }
String.prototype.rtrim=function(){  return this.replace(/\s+$/,""); }
]]></trim><getParameter author="qzone" date="" common=""><![CDATA[function getParameter(name,cancelBubble){
    var r = new RegExp("(\\?|#|&)"+name+"=([^&#]*)(&|#|$)")
    var m = location.href.match(r)
    if ((!m || m=="") && !cancelBubble) m = top.location.href.match(r)
    return (!m?"":m[2]);
}
]]></getParameter>
	<getPosition author="" date="" common=""><![CDATA[ function getPosition(obj) {
    var top=0;
    var left=0;
    var width=obj.offsetWidth;
    var height=obj.offsetHeight;
    while (obj.offsetParent) {
        top += obj.offsetTop;
        left += obj.offsetLeft;
        obj = obj.offsetParent;
    }
    return {"top":top,"left":left,"width":width,"height":height};
 }
]]></getPosition><getPosition author="BL" date="" common=""><![CDATA[var rePos = function () {
    return !window.opera && document.documentElement.getBoundingClientRect && function (o) {
        var pos = o.getBoundingClientRect()
			, root = o.ownerDocument
			, x = pos.left + root.documentElement.scrollLeft - 2
			, y = pos.top + root.documentElement.scrollTop - 2;
			
		try {
			var f = root.parentWindow || null;
			if (f) {
				var offset = 2 - (f.frameBorder || 1) * 2;
				x += offset, y += offset;
			}
		} catch (exp) {}
		return { x : x, y : y };
    } || function (o) {
        var x = 0, y = 0;
        do { x += o.offsetLeft, y += o.offsetTop; } while (o = o.offsetParent);
        return { 'x' : x, 'y' : y };
    };
}();]]></getPosition><UserData author="" date="" common=""><![CDATA[function  saveUserData(user,key,value){
  var ex; 
    if(!value){
        value = key;key=user;user="defaultUser"
    }
    with(document.documentElement)try {
    load(user);
    expires = new Date(new Date()-(-86400000)).toGMTString();
    setAttribute(key, value);
    save(user);
    return  getAttribute("value");
  }
  catch (ex){
        setCookie(key,value)
    }
}

function loadUserData(user,key){
    if(!key){
        key=user;user="defaultUser";
    }
  var ex; 
    with(document.documentElement)try{
    load(user);
    return getAttribute(key);
  }
  catch (ex){
        return getCookie(key);
    }
}

function  deleteUserData(user){
  var ex; 
    if(!user)user="defaultUser";
    with(document.documentElement)try{
      load(user);
    expires = new Date(new Date()-86400000).toGMTString();
    save(user);
  }
  catch (ex){
        deleteCookie(user)
    }
} 
]]></UserData>
	<UserData author="" date="" common=""><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> UserData manager </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="emu">
<META NAME="Keywords" CONTENT="IE USER DATA manager">
<META NAME="Description" CONTENT="UserData manager">
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
var isIE = !!document.all;
if(isIE)
document.documentElement.addBehavior("#default#userdata");
function  saveUserData(key, value){
    var ex; 
    if(isIE){
        with(document.documentElement)try {
            load(key);
            setAttribute("value", value);
            save(key);
            return  getAttribute("value");
        }catch (ex){
            alert(ex.message)
        }
    }else if(window.sessionStorage){//for firefox 2.0+
        try{
            sessionStorage.setItem(key,value)
        }catch (ex){
            alert(ex);
        }
    }else{
        alert("当前浏览器不支持userdata或者sessionStorage特性")
    }
}

function loadUserData(key){
    var ex; 
    if(isIE){
        with(document.documentElement)try{
            load(key);
            return getAttribute("value");
        }catch (ex){
            alert(ex.message);return null;
        }
    }else if(window.sessionStorage){//for firefox 2.0+
        try{
            return sessionStorage.getItem(key)
        }catch (ex){
            alert(ex)
        }
    }else{
        alert("当前浏览器不支持userdata或者sessionStorage特性")
    }
}
function  deleteUserData(key){
    var ex; 
    if(isIE){
        with(document.documentElement)try{
            load(key);
            expires = new Date(315532799000).toUTCString();
            save(key);
        }
        catch (ex){
            alert(ex.message);
        }
    }else if(window.sessionStorage){//for firefox 2.0+
        try{
            sessionStorage.removeItem(key)
        }catch (ex){
            alert(ex)
        }
    }else{
        alert("当前浏览器不支持userdata或者sessionStorage特性")
    }
} 

saveUserData("emu","hello world !")
alert(loadUserData("emu"))
deleteUserData("emu")
alert(loadUserData("emu"))
//-->
</SCRIPT>
</BODY>
</HTML>]]></UserData><LoadImage author="qzone" date="" common=""><![CDATA[// 以 <img src="about:blank" onerror=regImg(this,"http://...gif") /> 的方式定义图片可以避
// 免重复加载和图片堵塞页面问题。建议在发现图片下载造成页面延迟的情形下使用。
function regImg(e,src){
    if(!window.imgHash) window.imgHash = new Object();
    if(src.indexOf("[%")>0)return;
    src = src.replace(/<%.*%>/g,"")
    var a = imgHash[src];
    e.onerror=null;
    if(a==null) {
        e.style.display="none";
        a=imgHash[src]=[];
        a[0]=new Image();
        a[1]=e;
        a[0].onload=function(){setImges(a)};
        a[0].src=src;
    }else{
        if(a[0].readyState=="complete")
            e.src=src;
        else{
            e.style.display="none";
            a[a.length]=e;
        }
    }
}

function openImage(o){
       var redo = 10;
       var pNode = o.parentNode
    while(pNode){
        if (pNode.tagName == "A") return;
        if (redo<0) break;
        pNode = pNode.parentNode;
        redo --;
    }
    window.open(o.src,"imageView");
}

function setImges(a){
    for(var i=1;i<a.length;i++){
        a[i].src=a[0].src;
        a[i].style.display="";
    }
    a.length=1;
    a[0].onload=null;
}
]]></LoadImage><setTimeout author="" date="" common=""><![CDATA[if(!_st) var _st = window.setTimeout;
window.setTimeout = function(fRef, mDelay) {
    if(typeof fRef == 'function'){
        var argu = Array.prototype.slice.call(arguments,2);
        var f = (function(){ fRef.apply(null, argu); });
        return _st(f, mDelay);
    }
    return _st(fRef,mDelay);
}
]]></setTimeout><setInterval author="" date="" common=""><![CDATA[if(!_int) var _int = window.setInterval;
window.setInterval = function(fRef, mDelay) {
    if(typeof fRef == 'function'){
        var argu = Array.prototype.slice.call(arguments,2);
        var f = (function(){ fRef.apply(null, argu); });
        return _int(f, mDelay);
    }
    return _int(fRef,mDelay);
}
]]></setInterval><getCurrentStyle author="" date="" common=""><![CDATA[//获得当前样式
function getCurrentStyle(oElement, sProperty) {   
	if(oElement.currentStyle){   
		return oElement.currentStyle[sProperty];   
	}else if(window.getComputedStyle){   
		sProperty = sProperty.replace(/([A-Z])/g, "-$1").toLowerCase();   
		return window.getComputedStyle(oElement, null).getPropertyValue(sProperty);   
	}else{   
		return null;   
	}   
}]]></getCurrentStyle><parametersjson author="mxx" date="" common=""><![CDATA[//适用于location.search类型参数:?key=value&key=value
function ps2json(str){
    var ar = str.split(/[&|\?|=]/), o= {};
    while(ar.length>0) o[ar.shift()] = ar.length>0?ar.shift():"";
    return o;
}
]]></parametersjson><applycall author="" date="" common=""><![CDATA[//apply and call
if(typeof(Function.prototype.apply)!="function")
{
  Function.prototype.apply = function(obj, argu)
  {
    if(obj) obj.constructor.prototype.___caller = this;
    for(var a=[], i=0; i<argu.length; i++) a[i] = "argu["+ i +"]";
    var t = eval((obj ? "obj.___caller" : "this") +"("+ a.join(",") +");");
    if(obj) delete obj.constructor.prototype.___caller; return t;};
    Function.prototype.call = function(obj){
    for(var a=[], i=1; i<arguments.length; i++) a[i-1]=arguments[i];
    return this.apply(obj, a);
  }; 
}]]></applycall><parametersjson author="The Definitive Guide, 5th Edition" date="" common=""><![CDATA[function getArgs( ) {
    var args = new Object( );
    var query = location.search.substring(1);     // Get query string
    var pairs = query.split("&");                 // Break at ampersand
    for(var i = 0; i < pairs.length; i++) {
        var pos = pairs[i].indexOf('=');          // Look for "name=value"
        if (pos == -1) continue;                  // If not found, skip
        var argname = pairs[i].substring(0,pos);  // Extract the name
        var value = pairs[i].substring(pos+1);    // Extract the value
        value = decodeURIComponent(value);        // Decode it, if needed
        args[argname] = value;                    // Store as a property
    }
    return args;                                  // Return the object
}
]]></parametersjson><getSelectedText author="The Definitive Guide, 5th Edition" date="" common=""><![CDATA[//Example 15-12. Querying the currently selected text
function getSelectedText() {
    if (window.getSelection) {
        // This technique is the most likely to be standardized.
        // getSelection() returns a Selection object, which we do not document.
        return window.getSelection().toString();
    }
    else if (document.getSelection) {
        // This is an older, simpler technique that returns a string
        return document.getSelection();
    }
    else if (document.selection) {
        // This is the IE-specific technique.
        // We do not document the IE selection property or TextRange objects.
        return document.selection.createRange().text;
    }
}]]></getSelectedText><AjaxMethod author="The Definitive Guide, 5th Edition" date="" common=""><![CDATA[var HTTP = {};
// This is a list of XMLHttpRequest-creation factory functions to try
HTTP._factories = [
    function() { return new XMLHttpRequest(); },
    function() { return new ActiveXObject("Msxml2.XMLHTTP"); },
    function() { return new ActiveXObject("Microsoft.XMLHTTP"); }
];

// When we find a factory that works, store it here.
HTTP._factory = null;

// Create and return a new XMLHttpRequest object.
//
// The first time we're called, try the list of factory functions until
// we find one that returns a non-null value and does not throw an
// exception. Once we find a working factory, remember it for later use.
//
HTTP.newRequest = function() {
    if (HTTP._factory != null) return HTTP._factory();

    for(var i = 0; i < HTTP._factories.length; i++) {
        try {
            var factory = HTTP._factories[i];
            var request = factory();
            if (request != null) {
                HTTP._factory = factory;
                return request;
            }
        }
        catch(e) {
            continue;
        }
    }
    // If we get here, none of the factory candidates succeeded,
    // so throw an exception now and for all future calls.
    HTTP._factory 
 = function() {
        throw new Error("XMLHttpRequest not supported");
    }
    HTTP._factory(); // Throw an error
}

/**
 * Use XMLHttpRequest to fetch the contents of the specified URL using
 * an HTTP GET request. When the response arrives, pass it (as plain
 * text) to the specified callback function.
 *
 * This function does not block and has no return value.
 */
HTTP.getText = function(url, callback) {
    var request = HTTP.newRequest();
    request.onreadystatechange = function() {
        if (request.readyState == 4 && request.status == 200)
            callback(request.responseText);
    }
    request.open("GET", url);
    request.send(null);
};

HTTP.getXML = function(url, callback) {
    var request = HTTP.newRequest();
    request.onreadystatechange = function() {
        if (request.readyState == 4 && request.status == 200)
            callback(request.responseXML);
    }
    request.open("GET", url);
    request.send(null);
};

/**
 * Use an HTTP HEAD request to obtain the headers for the specified URL.
 * When the headers arrive, parse them with HTTP.parseHeaders() and pass the
 * resulting object to the specified callback function. If the server returns
* an error code, invoke the specified errorHandler function instead. If no
 * error handler is specified, pass null to the callback function.
 */
HTTP.getHeaders = function(url, callback, errorHandler) {
    var request = HTTP.newRequest();
    request.onreadystatechange = function() {
        if (request.readyState == 4) {
            if (request.status == 200) {
                callback(HTTP.parseHeaders(request));
            }
            else {
                if (errorHandler) errorHandler(request.status,
                                               request.statusText);
                else callback(null);
            }
        }
    }
    request.open("HEAD", url);
    request.send(null);
};

// Parse the response headers from an XMLHttpRequest object and return
// the header names and values as property names and values of a new object.
HTTP.parseHeaders = function(request) {
    var headerText = request.getAllResponseHeaders();  // Text from the server
    var headers = {}; // This will be our return value
    var ls = /^\s*/;  // Leading space regular expression
    var ts = /\s*$/;  // Trailing space regular expression

    // Break the headers into lines
    var lines = headerText.split("\n");
    // Loop through the lines
    for(var i = 0; i < lines.length; i++) {
        var line = lines[i];
        if (line.length == 0) continue;  // Skip empty lines
        // Split each line at first colon, and trim whitespace away
        var pos = line.indexOf(':');
        var name = line.substring(0, pos).replace(ls, "").replace(ts, "");
        var value = line.substring(pos+1).replace(ls, "").replace(ts, "");
        // Store the header name/value pair in a JavaScript object
        headers[name] = value;
    }
    return headers;
};

/**
 * Send an HTTP POST request to the specified URL, using the names and values
 * of the properties of the values object as the body of the request.
 * Parse the server's response according to its content type and pass
 * the resulting value to the callback function. If an HTTP error occurs,
 * call the specified errorHandler function, or pass null to the callback
 * if no error handler is specified.
 **/
HTTP.post = function(url, values, callback, errorHandler) {
    var request = HTTP.newRequest();
    request.onreadystatechange = function() {
        if (request.readyState == 4) {
            if (request.status == 200) {
                callback(HTTP._getResponse(request));
            }
            else {
                if (errorHandler) errorHandler(request.status,
                                               request.statusText);
                else callback(null);
            }
        }
    }

    request.open("POST", url);
    // This header tells the server how to interpret the body of the request.
    request.setRequestHeader("Content-Type",
                             "application/x-www-form-urlencoded");
    // Encode the properties of the values object and send them as
    // the body of the request.
    request.send(HTTP.encodeFormData(values));
};

/**
 * Encode the property name/value pairs of an object as if they were from
 * an HTML form, using application/x-www-form-urlencoded format
 */
HTTP.encodeFormData = function(data) {
    var pairs = [];
    var regexp = / /g; // A regular expression to match an encoded space

    for(var name in data) {
        var value = data[name].toString();
        // Create a name/value pair, but encode name and value first
        // The global function encodeURIComponent does almost what we want,
        // but it encodes spaces as   instead of as "+". We have to
        // fix that with String.replace()
        var pair = encodeURIComponent(name).replace(regexp,"+") + '=' +
            encodeURIComponent(value).replace(regexp,"+");
        pairs.push(pair);
    }

    // Concatenate all the name/value pairs, separating them with &
    return pairs.join('&');
};

HTTP._getResponse = function(request) {
    // Check the content type returned by the server
    switch(request.getResponseHeader("Content-Type")) {
    case "text/xml":
        // If it is an XML document, use the parsed Document object.
        return request.responseXML;

    case "text/json":
    case "text/javascript":
    case "application/javascript":
    case "application/x-javascript":
        // If the response is JavaScript code, or a JSON-encoded value,
        // call eval() on the text to "parse" it to a JavaScript value.
        // Note: only do this if the JavaScript code is from a trusted server!
        return eval(request.responseText);

    default:
        // Otherwise, treat the response as plain text and return as a string.
        return request.responseText;
    }
};

/**
 * Send an HTTP GET request for the specified URL. If a successful
 * response is received, it is converted to an object based on the
 * Content-Type header and passed to the specified callback function.
 * Additional arguments may be specified as properties of the options object.
 *
 * If an error response is received (e.g., a 404 Not Found error),
 * the status code and message are passed to the options.errorHandler
 * function. If no error handler is specified, the callback
 * function is called instead with a null argument.
 *
 * If the options.parameters object is specified, its properties are
 * taken as the names and values of request parameters. They are
 * converted to a URL-encoded string with HTTP.encodeFormData() and
 * are appended to the URL following a '?'.
 *
 * If an options.progressHandler function is specified, it is
 * called each time the readyState property is set to some value less
 * than 4. Each call to the progress-handler function is passed an
 * integer that specifies how many times it has been called.
 *
 * If an options.timeout value is specified, the XMLHttpRequest
 * is aborted if it has not completed before the specified number
 * of milliseconds have elapsed. If the timeout elapses and an
 * options.timeoutHandler is specified, that function is called with
 * the requested URL as its argument.
 **/
HTTP.get = function(url, callback, options) {
    var request = HTTP.newRequest();
    var n = 0;
    var timer;
    if (options.timeout)
        timer = setTimeout(function() {
                               request.abort();
                               if (options.timeoutHandler)
                                   options.timeoutHandler(url);
                           },
                           options.timeout);

    request.onreadystatechange = function() {
        if (request.readyState == 4) {
            if (timer) clearTimeout(timer);
            if (request.status == 200) {
                callback(HTTP._getResponse(request));
            }
            else {
                if (options.errorHandler)
                    options.errorHandler(request.status,
                                         request.statusText);
                else callback(null);
            }
        }
        else if (options.progressHandler) {
            options.progressHandler(++n);
        }
    }

    var target = url;
    if (options.parameters)
        target += "?" + HTTP.encodeFormData(options.parameters)
    request.open("GET", target);
    request.send(null);
};

HTTP.getTextWithScript = function(url, callback) {
    // Create a new script element and add it to the document.
    var script = document.createElement("script");
    document.body.appendChild(script);

    // Get a unique function name.
    var funcname = "func" + HTTP.getTextWithScript.counter++;

    // Define a function with that name, using this function as a
    // convenient namespace. The script generated on the server
    // invokes this function.
    HTTP.getTextWithScript[funcname] = function(text) {
        // Pass the text to the callback function
        callback(text);

        // Clean up the script tag and the generated function.
        document.body.removeChild(script);
        delete HTTP.getTextWithScript[funcname];
    }

    // Encode the URL we want to fetch and the name of the function
    // as arguments to the jsquoter.php server-side script. Set the src
    // property of the script tag to fetch the URL.
    script.src = "jsquoter.php" +
                 "?url=" + encodeURIComponent(url) + "&func=" +
                 encodeURIComponent("HTTP.getTextWithScript." + funcname);
}

// We use this to generate unique function callback names in case there
// is more than one request pending at a time.
HTTP.getTextWithScript.counter = 0;

]]></AjaxMethod><XML author="The Definitive Guide, 5th Edition" date="" common=""><![CDATA[var XML={};
/**
 * Create a new Document object. If no arguments are specified,
 * the document will be empty. If a root tag is specified, the document
 * will contain that single root tag. If the root tag has a namespace
 * prefix, the second argument must specify the URL that identifies the
 * namespace.
 */
XML.newDocument = function(rootTagName, namespaceURL) {
    if (!rootTagName) rootTagName = "";
    if (!namespaceURL) namespaceURL = "";

    if (document.implementation && document.implementation.createDocument) {
        // This is the W3C standard way to do it
        return document.implementation.createDocument(namespaceURL,
                                                      rootTagName, null);
    }
    else { // This is the IE way to do it
        // Create an empty document as an ActiveX object
        // If there is no root element, this is all we have to do
        var doc = new ActiveXObject("MSXML2.DOMDocument");

        // If there is a root tag, initialize the document
        if (rootTagName) {
            // Look for a namespace prefix
            var prefix = "";
            var tagname = rootTagName;
            var p = rootTagName.indexOf(':');
            if (p != -1) {
                prefix = rootTagName.substring(0, p);
                tagname = rootTagName.substring(p+1);
            }

            // If we have a namespace, we must have a namespace prefix
            // If we don't have a namespace, we discard any prefix
            if (namespaceURL) {
                if (!prefix) prefix = "a0"; // What Firefox uses
            }
            else prefix = "";

            // Create the root element (with optional namespace) as a
            // string of text
            var text = "<" + (prefix?(prefix+":"):"") +  tagname +
                (namespaceURL
                 ?(" xmlns:" + prefix + '="' + namespaceURL +'"')
                 :"") +
                "/>";
            // And parse that text into the empty document
            doc.loadXML(text);
        }
        return doc;
    }
};

/**
 * Synchronously load the XML document at the specified URL and
 * return it as a Document object
 */
XML.load = function(url) {
    // Create a new document with the previously defined function
    var xmldoc = XML.newDocument( );
    xmldoc.async = false;  // We want to load synchronously
    xmldoc.load(url);      // Load and parse
    return xmldoc;         // Return the document
};

/**
 * Asynchronously load and parse an XML document from the specified URL.
 * When the document is ready, pass it to the specified callback function.
 * This function returns immediately with no return value.
 */
XML.loadAsync = function(url, callback) {
    var xmldoc = XML.newDocument( );

    // If we created the XML document using createDocument, use
    // onload to determine when it is loaded
    if (document.implementation && document.implementation.createDocument) {
        xmldoc.onload = function( ) { callback(xmldoc); };
    }
    // Otherwise, use onreadystatechange as with XMLHttpRequest
    else {
        xmldoc.onreadystatechange = function( ) {
            if (xmldoc.readyState == 4) callback(xmldoc);
        };
    }

    // Now go start the download and parsing
    xmldoc.load(url);
};

/**
 * Parse the XML document contained in the string argument and return
 * a Document object that represents it.
 */
XML.parse = function(text) {
    if (typeof DOMParser != "undefined") {
        // Mozilla, Firefox, and related browsers
        return (new DOMParser( )).parseFromString(text, "application/xml");
    }
    else if (typeof ActiveXObject != "undefined") {
        // Internet Explorer.
        var doc = XML.newDocument( );  // Create an empty document
        doc.loadXML(text);            // Parse text into it
        return doc;                   // Return it
    }
    else {
        // As a last resort, try loading the document from a data: URL
        // This is supposed to work in Safari. Thanks to Manos Batsis and
        // his Sarissa library (sarissa.sourceforge.net) for this technique.
        var url = "data:text/xml;charset=utf-8," + encodeURIComponent(text);
        var request = new XMLHttpRequest( );
        request.open("GET", url, false);
        request.send(null);
        return request.responseXML;
    }
};

/**
 * Return a Document object that holds the contents of the <xml> tag 

 * with the specified id. If the <xml> tag has a src attribute, an XML
 * document is loaded from that URL and returned instead.
 *
 * Since data islands are often looked up more than once, this function caches
 * the documents it returns.
 */
XML.getDataIsland = function(id) {
    var doc;

    // Check the cache first
    doc = XML.getDataIsland.cache[id];
    if (doc) return doc;

    // Look up the specified element
    doc = document.getElementById(id);

    // If there is a "src" attribute, fetch the Document from that URL
    var url = doc.getAttribute('src');
    if (url) {
        doc = XML.load(url);
    }
    // Otherwise, if there was no src attribute, the content of the <xml>
    // tag is the document we want to return. In Internet Explorer, doc is
    // already the document object we want. In other browsers, doc refers to
    // an HTML element, and we've got to copy the content of that element
    // into a new document object
    else if (!doc.documentElement) {// If this is not already a document...

        // First, find the document element within the <xml> tag. This is
        // the first child of the <xml> tag that is an element, rather
        // than text, comment, or processing instruction
        var docelt = doc.firstChild;
        while(docelt != null) {
            if (docelt.nodeType == 1 /*Node.ELEMENT_NODE*/) break;
            docelt = docelt.nextSibling;
        }

        // Create an empty document
        doc = XML.newDocument( );

        // If the <xml> node had some content, import it into the new document
        if (docelt) doc.appendChild(doc.importNode(docelt, true));
    }

    // Now cache and return the document
    XML.getDataIsland.cache[id] = doc;
    return doc;
};
XML.getDataIsland.cache = {}; // Initialize the cache

/**
 * Extract data from the specified XML document and format it as an HTML table.
 * Append the table to the specified HTML element. (If element is a string,
 * it is taken as an element ID, and the named element is looked up.)
 *
 * The schema argument is a JavaScript object that specifies what data is to
 * be extracted and how it is to be displayed. The schema object must have a
 * property named "rowtag" that specifies the tag name of the XML elements that
 * contain the data for one row of the table. The schema object must also have
 * a property named "columns" that refers to an array. The elements of this
 * array specify the order and content of the columns of the table. Each
 * array element may be a string or a JavaScript object. If an element is a
 * string, that string is used as the tag name of the XML element that contains
 * table data for the column, and also as the column header for the column.
 * If an element of the columns[] array is an object, it must have one property
 * named "tagname" and one named "label". The tagname property is used to
 * extract data from the XML document and the label property is used as the
 * column header text. If the tagname begins with an @ character, it is
 * an attribute of the row element rather than a child of the row.
 */
function makeTable(xmldoc, schema, element) {
    // Create the <table> element
    var table = document.createElement("table");

    // Create the header row of <th> elements in a <tr> in a <thead>
    var thead = document.createElement("thead");
    var header = document.createElement("tr");
    for(var i = 0; i < schema.columns.length; i++) {
        var c = schema.columns[i];
        var label = (typeof c == "string")?c:c.label;
        var cell = document.createElement("th");
        cell.appendChild(document.createTextNode(label));
        header.appendChild(cell);
    }
    // Put the header into the table
    thead.appendChild(header);
    table.appendChild(thead);

    // The remaining rows of the table go in a <tbody>
    var tbody = document.createElement("tbody");
    table.appendChild(tbody);

    // Now get the elements that contain our data from the xml document
    var xmlrows = xmldoc.getElementsByTagName(schema.rowtag);

    // Loop through these elements. Each one contains a row of the table.
    for(var r=0; r < xmlrows.length; r++) {
        // This is the XML element that holds the data for the row
        var xmlrow = xmlrows[r];
        // Create an HTML element to display the data in the row
        var row = document.createElement("tr");

        // Loop through the columns specified by the schema object
        for(var c = 0; c < schema.columns.length; c++) {
            var sc = schema.columns[c];
            var tagname = (typeof sc == "string")?sc:sc.tagname;
            var celltext;
            if (tagname.charAt(0) == '@') {
                // If the tagname begins with '@', it is an attribute name
                celltext = xmlrow.getAttribute(tagname.substring(1));
            }
            else {
                // Find the XML element that holds the data for this column
                var xmlcell = xmlrow.getElementsByTagName(tagname)[0];
                // Assume that element has a text node as its first child
                var celltext = xmlcell.firstChild.data;
            }
            // Create the HTML element for this cell
            var cell = document.createElement("td");
            // Put the text data into the HTML cell
            cell.appendChild(document.createTextNode(celltext));
            // Add the cell to the row
            row.appendChild(cell);
        }

        // And add the row to the tbody of the table
        tbody.appendChild(row);
    }

    // Set an HTML attribute on the table element by setting a property.
    // Note that in XML we must use setAttribute( ) instead.
    table.frame = "border";

    // Now that we've created the HTML table, add it to the specified element.
    // If that element is a string, assume it is an element ID.
    if (typeof element == "string") element = document.getElementById(element);
    element.appendChild(table);
}

/**
 * This XML.Transformer class encapsulates an XSL stylesheet.
 * If the stylesheet parameter is a URL, we load it.
 * Otherwise, we assume it is an appropriate DOM Document.
 */
XML.Transformer = function(stylesheet) {
    // Load the stylesheet if necessary.
    if (typeof stylesheet == "string") stylesheet = XML.load(stylesheet);
    this.stylesheet = stylesheet;

    // In Mozilla-based browsers, create an XSLTProcessor object and
    // tell it about the stylesheet.
    if (typeof XSLTProcessor != "undefined") {
        this.processor = new XSLTProcessor( );
        this.processor.importStylesheet(this.stylesheet);
    }
};

/**
 * This is the transform( ) method of the XML.Transformer class.
 * It transforms the specified xml node using the encapsulated stylesheet.
 * The results of the transformation are assumed to be HTML and are used to
 * replace the content of the specified element.
 */
XML.Transformer.prototype.transform = function(node, element) {
    // If element is specified by id, look it up.
    if (typeof element == "string") element = document.getElementById(element);

    if (this.processor) {
        // If we've created an XSLTProcessor (i.e., we're in Mozilla) use it.
        // Transform the node into a DOM DocumentFragment.
        var fragment = this.processor.transformToFragment(node, document);
        // Erase the existing content of element.
        element.innerHTML = "";
        // And insert the transformed nodes.
        element.appendChild(fragment);
    }
    else if ("transformNode" in node) {
        // If the node has a transformNode( ) function (in IE), use that.
        // Note that transformNode( ) returns a string.
        element.innerHTML = node.transformNode(this.stylesheet);
    }
    else {
        // Otherwise, we're out of luck.
        throw "XSLT is not supported in this browser";
    }
};

/**
 * This is an XSLT utility function that is useful when a stylesheet is
 * used only once.
 */
XML.transform = function(xmldoc, stylesheet, element) {
    var transformer = new XML.Transformer(stylesheet);
    transformer.transform(xmldoc, element);
}

/**
 * XML.XPathExpression is a class that encapsulates an XPath query and its
 * associated namespace prefix-to-URL mapping. Once an XML.XPathExpression
 * object has been created, it can be evaluated one or more times (in one
 * or more contexts) using the getNode( ) or getNodes( ) methods.
 *
 * The first argument to this constructor is the text of the XPath expression.
 *
 * If the expression includes any XML namespaces, the second argument must
 * be a JavaScript object that maps namespace prefixes to the URLs that define
 * those namespaces. The properties of this object are the prefixes, and
 * the values of those properties are the URLs.
 */
XML.XPathExpression = function(xpathText, namespaces) {
    this.xpathText = xpathText;    // Save the text of the expression
    this.namespaces = namespaces;  // And the namespace mapping

    if (document.createExpression) {
        // If we're in a W3C-compliant browser, use the W3C API
        // to compile the text of the XPath query
        this.xpathExpr =
            document.createExpression(xpathText,
                                      // This function is passed a
                                      // namespace prefix and returns the URL.
                                      function(prefix) {
                                          return namespaces[prefix];
                                      });
    }
    else {
        // Otherwise, we assume for now that we're in IE and convert the
        // namespaces object into the textual form that IE requires.
        this.namespaceString = "";
        if (namespaces != null) {
            for(var prefix in namespaces) {
                // Add a space if there is already something there
                if (this.namespaceString) this.namespaceString += ' ';
                // And add the namespace
                this.namespaceString += 'xmlns:' + prefix + '="' +
                    namespaces[prefix] + '"';
            }
        }
    }
};

/**
 * This is the getNodes( ) method of XML.XPathExpression. It evaluates the
 * XPath expression in the specified context. The context argument should
 * be a Document or Element object. The return value is an array
 * or array-like object containing the nodes that match the expression.
 */
XML.XPathExpression.prototype.getNodes = function(context) {
    if (this.xpathExpr) {
        // If we are in a W3C-compliant browser, we compiled the
        // expression in the constructor. We now evaluate that compiled
        // expression in the specified context.
        var result =
            this.xpathExpr.evaluate(context,
                                    // This is the result type we want
                                    XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
                                    null);

        // Copy the results we get into an array.
        var a = new Array(result.snapshotLength);
        for(var i = 0; i < result.snapshotLength; i++) {
            a[i] = result.snapshotItem(i);
        }
        return a;
    }
    else {
        // If we are not in a W3C-compliant browser, attempt to evaluate
        // the expression using the IE API.
        try {
            // We need the Document object to specify namespaces
            var doc = context.ownerDocument;
            // If the context doesn't have ownerDocument, it is the Document
            if (doc == null) doc = context;
            // This is IE-specific magic to specify prefix-to-URL mapping
            doc.setProperty("SelectionLanguage", "XPath");
            doc.setProperty("SelectionNamespaces", this.namespaceString);

            // In IE, the context must be an Element not a Document,
            // so if context is a document, use documentElement instead
            if (context == doc) context = doc.documentElement;
            // Now use the IE method selectNodes( ) to evaluate the expression
            return context.selectNodes(this.xpathText);
        }
        catch(e) {
            // If the IE API doesn't work, we just give up
            throw "XPath not supported by this browser.";
        }
    }
}


/**
 * This is the getNode( ) method of XML.XPathExpression. It evaluates the
 * XPath expression in the specified context and returns a single matching
 * node (or null if no node matches). If more than one node matches,
 * this method returns the first one in the document.
 * The implementation differs from getNodes( ) only in the return type.
 */
XML.XPathExpression.prototype.getNode = function(context) {
    if (this.xpathExpr) {
        var result =
            this.xpathExpr.evaluate(context,
                                    // We just want the first match
                                    XPathResult.FIRST_ORDERED_NODE_TYPE,
                                    null);
        return result.singleNodeValue;
    }
    else {
        try {
            var doc = context.ownerDocument;
            if (doc == null) doc = context;
            doc.setProperty("SelectionLanguage", "XPath");
            doc.setProperty("SelectionNamespaces", this.namespaceString);
            if (context == doc) context = doc.documentElement;
            // In IE call selectSingleNode instead of selectNodes
            return context.selectSingleNode(this.xpathText);
        }
        catch(e) {
            throw "XPath not supported by this browser.";
        }
    }
};

// A utility to create an XML.XPathExpression and call getNodes( ) on it
XML.getNodes = function(context, xpathExpr, namespaces) {
    return (new XML.XPathExpression(xpathExpr, namespaces)).getNodes(context);
};

// A utility to create an XML.XPathExpression and call getNode( ) on it
XML.getNode  = function(context, xpathExpr, namespaces) {
    return (new XML.XPathExpression(xpathExpr, namespaces)).getNode(context);
};

/**
 * Serialize an XML Document or Element and return it as a string.
 */
XML.serialize = function(node) {
    if (typeof XMLSerializer != "undefined")
        return (new XMLSerializer( )).serializeToString(node);
    else if (node.xml) return node.xml;
    else throw "XML.serialize is not supported or can't serialize " + node;
};

/*
 * Expand any templates at or beneath element e.
 * If any of the templates use XPath expressions with namespaces, pass
 * a prefix-to-URL mapping as the second argument as with XML.XPathExpression( )
 *
 * If e is not supplied, document.body is used instead. A common
 * use case is to call this function with no arguments in response to an
 * onload event handler. This automatically expands all templates.
 */
XML.expandTemplates = function(e, namespaces) {
    // Fix up arguments a bit.
    if (!e) e = document.body;
    else if (typeof e == "string") e = document.getElementById(e);
    if (!namespaces) namespaces = null; // undefined does not work

    // An HTML element is a template if it has a "datasource" attribute.
    // Recursively find and expand all templates. Note that we don't
    // allow templates within templates.
    if (e.getAttribute("datasource")) {
        // If it is a template, expand it.
        XML.expandTemplate(e, namespaces);
    }
    else {
        // Otherwise, recurse on each of the children. We make a static
        // copy of the children first so that expanding a template doesn't
        // mess up our iteration.
        var kids = []; // To hold copy of child elements
        for(var i = 0; i < e.childNodes.length; i++) {
            var c = e.childNodes[i];
            if (c.nodeType == 1) kids.push(e.childNodes[i]);
        }

        // Now recurse on each child element
        for(var i = 0; i < kids.length; i++)
            XML.expandTemplates(kids[i], namespaces);
    }
};

/**
 * Expand a single specified template.
 * If the XPath expressions in the template use namespaces, the second
 * argument must specify a prefix-to-URL mapping
 */
XML.expandTemplate = function(template, namespaces) {
    if (typeof template=="string") template=document.getElementById(template);
    if (!namespaces) namespaces = null; // Undefined does not work

    // The first thing we need to know about a template is where the
    // data comes from.
    var datasource = template.getAttribute("datasource");

    // If the datasource attribute begins with '#', it is the name of
    // an XML data island. Otherwise, it is the URL of an external XML file.
    var datadoc;
    if (datasource.charAt(0) == '#')   // Get data island
        datadoc = XML.getDataIsland(datasource.substring(1));
    else                               // Or load external document
        datadoc = XML.load(datasource);

    // Now figure out which nodes in the datasource will be used to
    // provide the data. If the template has a foreach attribute,
    // we use it as an XPath expression to get a list of nodes. Otherwise,
    // we use all child elements of the document element.
    var datanodes;
    var foreach = template.getAttribute("foreach");
    if (foreach) datanodes = XML.getNodes(datadoc, foreach, namespaces);
    else {
        // If there is no "foreach" attribute, use the element
        // children of the documentElement
        datanodes = [];
        for(var c=datadoc.documentElement.firstChild; c!=null; c=c.nextSibling)
            if (c.nodeType == 1) datanodes.push(c);
    }

    // Remove the template element from its parent,
    // but remember the parent, and also the nextSibling of the template.
    var container = template.parentNode;
    var insertionPoint = template.nextSibling;
    template = container.removeChild(template);

    // For each element of the datanodes array, we'll insert a copy of
    // the template back into the container. Before doing this, though, we
    // expand any child in the copy that has a "data" attribute.
    for(var i = 0; i < datanodes.length; i++) {
        var copy = template.cloneNode(true);           // Copy template
        expand(copy, datanodes[i], namespaces);        // Expand copy
        container.insertBefore(copy, insertionPoint);  // Insert copy
    }

    // This nested function finds any child elements of e that have a data
    // attribute. It treats that attribute as an XPath expression and
    // evaluates it in the context of datanode. It takes the text value of
    // the XPath result and makes it the content of the HTML node being
    // expanded. All other content is deleted.
    function expand(e, datanode, namespaces) {
        for(var c = e.firstChild; c != null; c = c.nextSibling) {
            if (c.nodeType != 1) continue;  // elements only
            var dataexpr = c.getAttribute("data");
            if (dataexpr) {
                // Evaluate XPath expression in context.
                var n = XML.getNode(datanode, dataexpr, namespaces);
                // Delete any content of the element
                c.innerHTML = "";
                // And insert the text content of the XPath result
                c.appendChild(document.createTextNode(getText(n)));
            }
            // If we don't expand the element, recurse on it.
            else expand(c, datanode, namespaces);
        }
    }

    // This nested function extracts the text from a DOM node, recursing
    // if necessary.
    function getText(n) {
        switch(n.nodeType) {
        case 1: /* element */
            var s = "";
            for(var c = n.firstChild; c != null; c = c.nextSibling)
                s += getText(c);
            return s;
        case 2: /* attribute*/
        case 3: /* text */
        case 4: /* cdata */
            return n.nodeValue;
        default:
            return "";
        }
    }

};


]]></XML><Drag author="The Definitive Guide, 5th Edition" date="" common=""><![CDATA[/**
 * Drag.js: drag absolutely positioned HTML elements.
 *
 * This module defines a single drag( ) function that is designed to be called
 * from an onmousedown event handler. Subsequent mousemove events will
 * move the specified element. A mouseup event will terminate the drag.
 * If the element is dragged off the screen, the window does not scroll.
 * This implementation works with both the DOM Level 2 event model and the
 * IE event model.
 *
 * Arguments:
 *
 *   elementToDrag: the element that received the mousedown event or
 *     some containing element. It must be absolutely positioned. Its
 *     style.left and style.top values will be changed based on the user's
 *     drag.
 *
 *   event: the Event object for the mousedown event.
 **/
function drag(elementToDrag, event) {
    // The mouse position (in window coordinates)
    // at which the drag begins
    var startX = event.clientX, startY = event.clientY;

    // The original position (in document coordinates) of the
    // element that is going to be dragged. Since elementToDrag is
    // absolutely positioned, we assume that its offsetParent is the
    // document body.
    var origX = elementToDrag.offsetLeft, origY = elementToDrag.offsetTop;

    // Even though the coordinates are computed in different
    // coordinate systems, we can still compute the difference between them
    // and use it in the moveHandler( ) function. This works because
    // the scrollbar position never changes during the drag.
    var deltaX = startX - origX, deltaY = startY - origY;

    // Register the event handlers that will respond to the mousemove events
    // and the mouseup event that follow this mousedown event.
    if (document.addEventListener) {  // DOM Level 2 event model
        // Register capturing event handlers
        document.addEventListener("mousemove", moveHandler, true);
        document.addEventListener("mouseup", upHandler, true);
    }
    else if (document.attachEvent) {  // IE 5+ Event Model
        // In the IE event model, we capture events by calling
        // setCapture( ) on the element to capture them.
        elementToDrag.setCapture( );
        elementToDrag.attachEvent("onmousemove", moveHandler);
        elementToDrag.attachEvent("onmouseup", upHandler);
        // Treat loss of mouse capture as a mouseup event.
        elementToDrag.attachEvent("onlosecapture", upHandler);
    }
    else {  // IE 4 Event Model
        // In IE 4 we can't use attachEvent( ) or setCapture( ), so we set
        // event handlers directly on the document object and hope that the
        // mouse events we need will bubble up.
        var oldmovehandler = document.onmousemove; // used by upHandler( )
        var olduphandler = document.onmouseup;
        document.onmousemove = moveHandler;
        document.onmouseup = upHandler;
    }

    // We've handled this event. Don't let anybody else see it.
    if (event.stopPropagation) event.stopPropagation( );  // DOM Level 2
    else event.cancelBubble = true;                      // IE

    // Now prevent any default action.
    if (event.preventDefault) event.preventDefault( );   // DOM Level 2
    else event.returnValue = false;                     // IE

    /**
     * This is the handler that captures mousemove events when an element
     * is being dragged. It is responsible for moving the element.
     **/
    function moveHandler(e) {
        if (!e) e = window.event;  // IE Event Model

        // Move the element to the current mouse position, adjusted as
        // necessary by the offset of the initial mouse-click.
        elementToDrag.style.left = (e.clientX - deltaX) + "px";
        elementToDrag.style.top = (e.clientY - deltaY) + "px";

        // And don't let anyone else see this event.
        if (e.stopPropagation) e.stopPropagation( );  // DOM Level 2
        else e.cancelBubble = true;                  // IE
    }

    /**
     * This is the handler that captures the final mouseup event that
     * occurs at the end of a drag.
     **/
    function upHandler(e) {
        if (!e) e = window.event;  // IE Event Model

        // Unregister the capturing event handlers.
        if (document.removeEventListener) {  // DOM event model
            document.removeEventListener("mouseup", upHandler, true);
            document.removeEventListener("mousemove", moveHandler, true);
        }
        else if (document.detachEvent) {  // IE 5+ Event Model
            elementToDrag.detachEvent("onlosecapture", upHandler);
            elementToDrag.detachEvent("onmouseup", upHandler);
            elementToDrag.detachEvent("onmousemove", moveHandler);
            elementToDrag.releaseCapture( );
        }
        else {  // IE 4 Event Model
            // Restore the original handlers, if any
            document.onmouseup = olduphandler;
            document.onmousemove = oldmovehandler;
        }

        // And don't let the event propagate any further.
        if (e.stopPropagation) e.stopPropagation( );  // DOM Level 2
        else e.cancelBubble = true;                  // IE
    }
}

]]></Drag><Drag author="dh20156" date="" common=""><![CDATA[<html>
<head>
<title>drag drop test</title>
<style type="text/css">
div {width:300px;height:200px;background:#dcdcdc;border:1px solid #999;padding:20px;}
#d1 ul {list-style:none;margin:0;padding:0;}
#d1 ul li {margin:10px 0;background:#eee;}
</style>
<script type="text/javascript">
var dragDrop = function(_obj){
	Function.prototype.bind = function(_obj){
		var owner = this;
		return function(){
			owner.apply(_obj,arguments);
		}
	};
	this.obj = _obj;
	this.x = 0;
	this.y = 0;
	this.init();
}
dragDrop.prototype = {
	getPos:function(_obj){
		var _x = _obj.offsetLeft,_y = _obj.offsetTop;
		while(_obj=_obj.offsetParent){
			_x += _obj.offsetLeft;
			_y += _obj.offsetTop;
		}
		_obj = null;
		return {x:_x,y:_y};
	},
	mDown:function(e){
		e = e||window.event;
		var pos = this.getPos(this.obj);
		this.x = e.clientX - pos.x;
		this.y = e.clientY - pos.y;
		pos = null;
		this.obj.style.position = "absolute";
		this.obj.style.zIndex = "1000";
		document.body.onmousemove = this.mMove.bind(this);
		document.body.onmouseup = this.mUp.bind(this);
	},
	mMove:function(e){
		e = e||window.event;
		_mx = (e.clientX - this.x);
		_my = (e.clientY - this.y);
		this.setPos(this.obj,_mx,_my);
		if(!document.selection.empty){
			window.getSelection().removeAllRanges();
		}else{
			document.selection.empty();
		}
	},
	mUp:function(e){
		e = e||window.event;
		this.x = e.clientX-this.x;
		this.y = e.clientY-this.y;
		this.setPos(this.obj,this.x,this.y);
		this.obj.style.zIndex = "0";
		document.body.onmousemove = null;
		document.body.onmouseup = null;
	},
	setPos:function(_obj,x,y){
		_obj.style.left = x + "px";
		_obj.style.top = y + "px";
	},
	init:function(){
		this.obj.onmousedown = this.mDown.bind(this);
	}
}
</script>
</head>
<body>
	<div id="d1">
		<ul>
			<li>test</li>
			<li>test</li>
			<li>test:<input type="text"></li>
			<li>test:<input type="text"></li>
			<li>test</li>
			<li>test</li>
		</ul>
	</div>
	<div id="d2">
		test
	</div>
<script type="text/javascript">
var dda = new dragDrop(document.getElementById("d1"));
var ddb = new dragDrop(document.getElementById("d2"));
</script>
</body>
</html>]]></Drag><AnimateCSS author="The Definitive Guide, 5th Edition" date="" common=""><![CDATA[Example 16-6. A framework for CSS-based animations
/**
 * AnimateCSS.js:
 * This file defines a function named animateCSS(), which serves as a framework
 * for creating CSS-based animations. The arguments to this function are:
 *
 *     element: The HTML element to be animated.
 *     numFrames: The total number of frames in the animation.
 *     timePerFrame: The number of milliseconds to display each frame.
 *     animation: An object that defines the animation; described below.
 *     whendone: An optional function to call when the animation finishes.
 *               If specified, this function is passed element as its argument.
 *
 * The animateCSS() function simply defines an animation framework. It is
 * the properties of the animation object that specify the animation to be
 * done. Each property should have the same name as a CSS style property. The
 * value of each property must be a function that returns values for that
 * style property. Each function is passed the frame number and the total
 * amount of elapsed time, and it can use these to compute the style value it
 * should return for that frame. For example, to animate an image so that it
 * slides in from the upper left, you might invoke animateCSS as follows:
 *
 *  animateCSS(image, 25, 50,  // Animate image for 25 frames of 50ms each
 *             {  // Set top and left attributes for each frame as follows:
 *               top: function(frame,time) { return frame*8 + "px"; },
 *               left: function(frame,time) { return frame*8 + "px"; }
 *             });
 *
 **/
function animateCSS(element, numFrames, timePerFrame, animation, whendone) {
    var frame = 0;  // Store current frame number
    var time = 0;   // Store total elapsed time

    // Arrange to call displayNextFrame() every timePerFrame milliseconds.
    // This will display each of the frames of the animation.
    var intervalId = setInterval(displayNextFrame, timePerFrame);

    // The call to animateCSS() returns now, but the previous line ensures that
    // the following nested function will be invoked once for each frame
    // of the animation.
    function displayNextFrame() {
        if (frame >= numFrames) {             // First, see if we're done
            clearInterval(intervalId);        // If so, stop calling ourselves
            if (whendone) whendone(element);  // Invoke whendone function
            return;                           // And we're finished
        }

        // Now loop through all properties defined in the animation object
        for(var cssprop in animation) {
            // For each property, call its animation function, passing the
            // frame number and the elapsed time. Use the return value of the
            // function as the new value of the corresponding style property
            // of the specified element. Use try/catch to ignore any
            // exceptions caused by bad return values.
            try {
                element.style[cssprop] = animation[cssprop](frame, time);
            } catch(e) {}
        }

        frame++;               // Increment the frame number
        time += timePerFrame;  // Increment the elapsed time
    }
}

 

]]></AnimateCSS><CSSClass author="The Definitive Guide, 5th Edition" date="" common=""><![CDATA[/**
 * CSSClass.js: utilities for manipulating the CSS class of an HTML element.
 *
 * This module defines a single global symbol named CSSClass. This object
 * contains utility functions for working with the class attribute (className
 * property) of HTML elements. All functions take two arguments: the element
 * e being tested or manipulated and the CSS class c that is to be tested,
 * added, or removed. If element e is a string, it is taken as an element
 * id and passed to document.getElementById().
 */
var CSSClass = {};  // Create our namespace object
// Return true if element e is a member of the class c; false otherwise
CSSClass.is = function(e, c) {
    if (typeof e == "string") e = document.getElementById(e); // element id

    // Before doing a regexp search, optimize for a couple of common cases.
    var classes = e.className;
    if (!classes) return false;    // Not a member of any classes
    if (classes == c) return true; // Member of just this one class

    // Otherwise, use a regular expression to search for c as a word by itself
    // \b in a regular expression requires a match at a word boundary.
    return e.className.search("\\b" + c + "\\b") != -1;
};

// Add class c to the className of element e if it is not already there.
CSSClass.add = function(e, c) {
    if (typeof e == "string") e = document.getElementById(e); // element id
    if (CSSClass.is(e, c)) return; // If already a member, do nothing
    if (e.className) c = " " + c;  // Whitespace separator, if needed
    e.className += c;              // Append the new class to the end
};

// Remove all occurrences (if any) of class c from the className of element e
CSSClass.remove = function(e, c) {
    if (typeof e == "string") e = document.getElementById(e); // element id
    // Search the className for all occurrences of c and replace with "".
    // \s* matches any number of whitespace characters.
    // "g" makes the regular expression match any number of occurrences
    e.className = e.className.replace(new RegExp("\\b"+ c+"\\b\\s*", "g"), "");
};

]]></CSSClass><Stylesheet author="The Definitive Guide, 5th Edition" date="" common=""><![CDATA[/**
 * Stylesheet.js: utility methods for scripting CSS stylesheets.
 *
 * This module defines a Stylesheet class that is a simple wrapper
 * around an element of the document.styleSheets[] array. It defines useful
 * cross-platform methods for querying and modifying the stylesheet.
 **/

// Construct a new Stylesheet object that wraps the specified CSSStylesheet.
// If ss is a number, look up the stylesheet in the styleSheet[] array.
function Stylesheet(ss) {
    if (typeof ss == "number") ss = document.styleSheets[ss];
    this.ss = ss;
}

// Return the rules array for this stylesheet.
Stylesheet.prototype.getRules = function() {
    // Use the W3C property if defined; otherwise use the IE property
    return this.ss.cssRules?this.ss.cssRules:this.ss.rules;
}

// Return a rule of the stylesheet. If s is a number, we return the rule
// at that index.  Otherwise, we assume s is a selector and look for a rule
// that matches that selector.
Stylesheet.prototype.getRule = function(s) {
    var rules = this.getRules();
    if (!rules) return null;
    if (typeof s == "number") return rules[s];
    // Assume s is a selector
    // Loop backward through the rules so that if there is more than one
    // rule that matches s, we find the one with the highest precedence.
    s = s.toLowerCase();
    for(var i = rules.length-1; i >= 0; i--) {
        if (rules[i].selectorText.toLowerCase() == s) return rules[i];
    }
    return null;
};

// Return the CSS2Properties object for the specified rule.
// Rules can be specified by number or by selector.
Stylesheet.prototype.getStyles = function(s) {
    var rule = this.getRule(s);
    if (rule && rule.style) return rule.style;
    else return null;
};

// Return the style text for the specified rule.
Stylesheet.prototype.getStyleText = function(s) {
    var rule = this.getRule(s);
    if (rule && rule.style && rule.style.cssText) return rule.style.cssText;
    else return "";
};

// Insert a rule into the stylesheet.
// The rule consists of the specified selector and style strings.
// It is inserted at index n. If n is omitted, it is appended to the end.
Stylesheet.prototype.insertRule = function(selector, styles, n) {
    if (n == undefined) {
        var rules = this.getRules();
        n = rules.length;
    }
    if (this.ss.insertRule)   // Try the W3C API first
        this.ss.insertRule(selector + "{" + styles + "}", n);
    else if (this.ss.addRule) // Otherwise use the IE API
        this.ss.addRule(selector, styles, n);
};

// Remove the rule from the specified position in the stylesheet.
// If s is a number, delete the rule at that position.
// If s is a string, delete the rule with that selector.
// If n is not specified, delete the last rule in the stylesheet.
Stylesheet.prototype.deleteRule = function(s) {
    // If s is undefined, make it the index of the last rule
    if (s == undefined) {
        var rules = this.getRules();
        s = rules.length-1;
    }

    // If s is not a number, look for a matching rule and get its index.
    if (typeof s != "number") {
        s = s.toLowerCase();    // convert to lowercase
        var rules = this.getRules();
        for(var i = rules.length-1; i >= 0; i--) {
            if (rules[i].selectorText.toLowerCase() == s) {
                s = i;  // Remember the index of the rule to delete
                break;  // And stop searching
            }
        }

        // If we didn't find a match, just give up.
        if (i == -1) return;
    }

    // At this point, s will be a number.
    // Try the W3C API first, then try the IE API
    if (this.ss.deleteRule) this.ss.deleteRule(s);
    else if (this.ss.removeRule) this.ss.removeRule(s);
};


]]></Stylesheet><FormatString author="Meizz" date="" common=""><![CDATA[<script type="text/javascript">
String.prototype.format=function()
{
  if(arguments.length==0) return this;
  for(var s=this, i=0; i<arguments.length; i++)
    s=s.replace(new RegExp("\\{"+i+"\\}","g"), arguments[i]);
  return s;
};

alert("http://{0}/{1}/{2}".format("www.meizz.com", "web", "abc.htm"));
alert("请输入{0},输完后再按存盘按钮".format("姓名"));
</script>]]></FormatString><ArrayMove author="美洲豹" date="" common="移动某个数组元素的位置"><![CDATA[<script type="text/javascript">
function arrmove(arr,s,t){
	if(s==t) return arr;
	if(s<t){
		return arr.slice(0,s).concat(arr.slice(s+1,t+1),arr.slice(s,s+1),arr.slice(t+1,arr.length));
	}else{
		return arr.slice(0,t+1).concat(arr.slice(s,s+1),arr.slice(t+1,s),arr.slice(s+1,arr.length));
	}
}

var a = new Array(0,1,2,3,4,5,6,7);
a = arrmove(a,2,6);
alert(a);
</script>]]></ArrayMove><EndOfStream author="美洲豹" date="" common="检测MEDIAPLAYER播放结束"><![CDATA[<embed id="MediaPlayer1" src="http://www.v-ec.com/software/attachfile/thepromise.wma" autostart="1"></embed>

<script language="JavaScript" for="MediaPlayer1" event="EndOfStream">
alert("music end");
</script>]]></EndOfStream><ArrayMove author="JK" date="" common=""><![CDATA[<script>
Array.prototype.moveComponent=function (s,t){
	if(s!=t) {
		var temp=this[s];
		this.splice(s,1);
		this.splice(t,0,temp);
	}
	return this;
}
var a=new Array(0,1,2,3,4,5,6,7);
alert(a);
alert(a.moveComponent(2,6));
</script>]]></ArrayMove><selection author="CSDN" date="" common="在textarea光标位置插入字符"><![CDATA[<textarea style="width:400px;height:300px;">
FF
window.getSelection().removeAllRanges();
IE
document.selection.empty();

用途:
拖拽组件的时候,取消一些用户误操作的选中的文字
</textarea><button>insert</button>
<script type="text/javascript">
var strlen = function(str){
	return (/ie/i.test(navigator.appVersion) && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length;
};
var insertContent = function(obj,text){
	selection = document.selection;
	obj.focus();
	if(obj.selectionStart) {
		var opn = obj.selectionStart + 0;
		obj.value = obj.value.substr(0, obj.selectionStart) + text + obj.value.substr(obj.selectionEnd);
	} else if(selection && selection.createRange) {
		var sel = selection.createRange();
		sel.text = text;
		sel.moveStart('character', -strlen(text));
	} else {
		obj.value += text;
	}
};
var dtxt = document.getElementsByTagName('textarea')[0],dbtn = document.getElementsByTagName('button')[0];
dbtn.onclick = function(){insertContent(dtxt,'★');};
</script>]]></selection>
	<novenary author="JK" date="2007-9-13" common="九进制转换"><![CDATA[帮我写个函数（不能使用递归、循环）： 
要求： 
输入:1,输出:1     输入:2,输出:2 
输入:3,输出:3     输入:4,输出:5 
输入:5,输出:6     输入:6,输出:7 
输入:7,输出:8     输入:8,输出:9 
输入:9,输出:10    输入:10,输出:11
输入:11,输出:12   输入:12,输出:13 
输入:13,输出:15   输入:14,输出:16 
输入:15,输出:17   输入:16,输出:18
输入:17,输出:19   输入:18,输出:20
输入:19,输出:21   输入:20,输出:22 
输入:21,输出:23   输入:22,输出:25
输入:23,输出:26   输入:24,输出:27
输入:25,输出:28   输入:26,输出:29 
输入:27,输出:30   输入:28,输出:31 
输入:29,输出:32   输入:30,输出:33 
输入:30,输出:35   输入:32,输出:36
输入:33,输出:37   输入:34,输出:38
输入:35,输出:39   输入:36,输出:50 
输入:37,输出:51   ... 
...               ... 
也就是在输出里不能出现含有4的数字(输出的数字里不论是哪一位都不能有4),编写一函数输入一数字得出输出数字。 
不得使用递归、循环

<script>
function getOutput(num)
{
var str9=num.toString(9);
alert(str9);
var str10=str9.replace(/8/g,"9").replace(/7/g,"8").replace(/6/g,"7").replace(/5/g,"6").replace(/4/g,"5");
return parseInt(str10);
}
alert(getOutput(36));
</script>]]></novenary><MediaPlayer author="" date="" common=""><![CDATA[<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="mp" width="300" height="240">
  <param name="AudioStream" value="-1">
  <param name="AutoSize" value="-1">
  <!--是否自动调整播放大小-->
  <param name="AutoStart" value="-1">
  <!--是否自动播放-->
  <param name="AnimationAtStart" value="-1">
  <param name="AllowScan" value="-1">
  <param name="AllowChangeDisplaySize" value="-1">
  <param name="AutoRewind" value="0">
  <param name="Balance" value="0">
  <!--左右声道平衡,最左-9640,最右9640-->
  <param name="BaseURL" value>
  <param name="BufferingTime" value="15">
  <!--缓冲时间-->
  <param name="CaptioningID" value>
  <param name="ClickToPlay" value="-1">
  <param name="CursorType" value="0">
  <param name="CurrentPosition" value="0">
  <!--当前播放进度 -1 表示不变,0表示开头 单位是秒,比如10表示从第10秒处开始播放,值必须是-1.0或大于等于0-->
  <param name="CurrentMarker" value="0">
  <param name="DefaultFrame" value>
  <param name="DisplayBackColor" value="0">
  <param name="DisplayForeColor" value="16777215">
  <param name="DisplayMode" value="0">
  <param name="DisplaySize" value="0">
  <!--视频1-50%, 0-100%, 2-200%,3-全屏 其它的值作0处理,小数则采用四舍五入然后按前的处理-->
  <param name="Enabled" value="-1">
  <param name="EnableContextMenu" value="-1">
  <!-是否用右键弹出菜单控制-->
  <param name="EnablePositionControls" value="-1">
  <param name="EnableFullScreenControls" value="-1">
  <param name="EnableTracker" value="-1">
  <!--是否允许拉动播放进度条到任意地方播放-->
  <param name="Filename" value="bh.mp3" valuetype="ref">
  <param name="InvokeURLs" value="-1">
  <param name="Language" value="-1">
  <param name="Mute" value="0">
  <!--是否静音-->
  <param name="PlayCount" value="10">
  <!--重复播放次数,0为始终重复-->
  <param name="PreviewMode" value="-1">
  <param name="Rate" value="1">
  <!--播放速度1.0-2.0倍的速度播放-->
  <param name="SAMILang" value>
  <param name="SAMIStyle" value>
  <param name="SAMIFileName" value>
  <!--选择同时播放(伴音)的歌曲-->
  <param name="SelectionStart" value="-1">
  <param name="SelectionEnd" value="-1">
  <param name="SendOpenStateChangeEvents" value="-1">
  <param name="SendWarningEvents" value="-1">
  <param name="SendErrorEvents" value="-1">
  <param name="SendKeyboardEvents" value="0">
  <param name="SendMouseClickEvents" value="0">
  <param name="SendMouseMoveEvents" value="0">
  <param name="SendPlayStateChangeEvents" value="-1">
  <param name="ShowCaptioning" value="0">
  <!--是否显示字幕,为一块黑色,下面会有一大块黑色,一般不显示-->
  <param name="ShowControls" value="-1">
  <!--是否显示控制,比如播放,停止,暂停-->
  <param name="ShowAudioControls" value="-1">
  <!--是否显示音量控制-->
  <param name="ShowDisplay" value="0">
  <!--显示节目信息,比如版权等-->
  <param name="ShowGotoBar" value="0">
  <!--一条框,在下面,有往下箭头-->
  <param name="ShowPositionControls" value="-1">
  <!--是否显示往前往后及列表,如果显示一般也都是灰色不可控制-->
  <param name="ShowStatusBar" value="-1">
  <!--当前播放信息,显示是否正在播放,及总播放时间和当前播放到的时间-->
  <param name="ShowTracker" value="-1">
  <!--是否显示当前播放跟踪条,即当前的播放进度条-->
  <param name="TransparentAtStart" value="-1">
  <param name="VideoBorderWidth" value="0">
  <!--显示部的宽部,如果小于视频宽,则最小为视频宽,或者加大到指定值,并自动加大高度.此改变只改变四周的黑框大小,不改变视频大小-->
  <param name="VideoBorderColor" value="0">
  <!--显示黑色框的颜色, 为RGB值,比如ffff00为黄色-->
  <param name="VideoBorder3D" value="0">
  <param name="Volume" value="0">
  <!--音量大小,负值表示是当前音量的减值,值自动会取绝对值,最大为0,最小为-9640,最大0-->
  <param name="WindowlessVideo" value="0">
  <!--如果是0可以允许全屏,否则只能在窗口中查看-->
</object>
  <br>
  <b>播放控制:</b><br>
  音乐切换:
  <input type="button" onclick="mp.Filename='sha.mp3'" value="你是风儿我是沙">
  <input type="button" onclick="mp.Filename='bh.mp3'" value="白狐">
  <input type="button" onclick="alert(mp.Filename)" value="当前曲目">
  <br>
  播放控制:
  <input type="button" onclick="mp.play()" value="播放">
  <input type="button" onclick="mp.pause()" value="暂停">
  <input type="button" onclick="mp.pause();mp.CurrentPosition=0" value="停止">
  <br>
  声道控制:
  <input type="button" onclick="mp.Balance=9640" value="左声道">
  <input type="button" onclick="mp.Balance=0" value="立体声">
  <input type="button" onclick="mp.Balance=-9640" value="右声道">
  <input type="button" onclick="alert(mp.Balance)" value="当前状态">
  <br>
  进度控制:
  <input type="button" onclick="mp.CurrentPosition=0" value="回到开始">
  <input type="button" onclick="mp.CurrentPosition+=60" value="快进一分钟">
  <input type="button" onclick="mp.CurrentPosition-=60" value="快退一分钟">
  <input type="button" onclick="alert(mp.Duration)" value="总长度">
  <input type="button" onclick="alert(mp.CurrentPosition)" value="当前进度">
  <br>
  音量控制:
  <script language="javascript">
  function setVolume(num)
  {
  var mp=document.getElementById("mp")
  tnum=mp.Volume+num
  if(tnum>0){tnum=0}
  if(tnum<-10000){tnum=-10000}
  mp.Volume=tnum
  }
  </script>
  <input type="button" onclick="setVolume(200)" value="音量+">
  <input type="button" onclick="setVolume(-200)" value="音量-">
  <input type="button" onclick="mp.Volume=0" value="最大">
  <input type="button" onclick="mp.Volume=-10000" value="最小">
  <input type="button" onclick="mp.Mute=-1" value="静音">
  <input type="button" onclick="mp.Mute=0" value="取消静音">
  <input type="button" onclick="alert(mp.Volume)" value="当前音量">
  <br>
  速度控制:
  <input type="button" onclick="if(mp.Rate<2){mp.Rate+=0.1}" value="加速">
  <input type="button" onclick="if(mp.Rate>0.2){mp.Rate-=0.1}" value="减速">
  <input type="button" onclick="mp.Rate=1" value="正常">
  <input type="button" onclick="alert(mp.Rate)" value="当前速度">
  <br><b>界面控制:</b><br>
  字幕控制:
  <input type="button" onclick="mp.ShowCaptioning=-1" value="显示">
  <input type="button" onclick="mp.ShowCaptioning=0" value="隐藏">
  <input type="button" onclick="alert(mp.ShowCaptioning)" value="当前状态">
  <br>
  音量控制:
  <input type="button" onclick="mp.ShowAudioControls=-1" value="显示">
  <input type="button" onclick="mp.ShowAudioControls=0" value="隐藏">
  <input type="button" onclick="alert(mp.ShowAudioControls)" value="当前状态">
  <br>
  播放控制:
  <input type="button" onclick="mp.ShowControls=-1" value="显示">
  <input type="button" onclick="mp.ShowControls=0" value="隐藏">
  <input type="button" onclick="alert(mp.ShowControls)" value="当前状态">
  <br>
  媒体信息:
  <input type="button" onclick="mp.ShowDisplay=-1" value="显示">
  <input type="button" onclick="mp.ShowDisplay=0" value="隐藏">
  <input type="button" onclick="alert(mp.ShowDisplay)" value="当前状态">
  <br>
  GotoBar :
  <input type="button" onclick="mp.ShowGotoBar=-1" value="显示">
  <input type="button" onclick="mp.ShowGotoBar=0" value="隐藏">
  <input type="button" onclick="alert(mp.ShowGotoBar)" value="当前状态">
  <br>
  状 态 栏:
  <input type="button" onclick="mp.ShowStatusBar=-1" value="显示">
  <input type="button" onclick="mp.ShowStatusBar=0" value="隐藏">
  <input type="button" onclick="alert(mp.ShowStatusBar)" value="当前状态">
  <br>
  跟 踪 条:
  <input type="button" onclick="mp.ShowTracker=-1" value="显示">
  <input type="button" onclick="mp.ShowTracker=0" value="隐藏">
  <input type="button" onclick="alert(mp.ShowTracker)" value="当前状态">
  <br>
  位置控制:
  <input type="button" onclick="mp.ShowPositionControls=-1" value="显示">
  <input type="button" onclick="mp.ShowPositionControls=0" value="隐藏">
  <input type="button" onclick="alert(mp.ShowPositionControls)" value="当前状态">
  <br>
  窗口缩放:
  <input type="button" onclick="mp.DisplaySize=1" value="50%">
  <input type="button" onclick="mp.DisplaySize=0" value="100%">
  <input type="button" onclick="mp.DisplaySize=2" value="200%">
  <input type="button" onclick="mp.DisplaySize=3" value="全屏">
  <input type="button" onclick="alert(mp.DisplaySize)" value="当前状态">]]></MediaPlayer><JsLoader author="emu,chenzishun" date="" common=""><![CDATA[function loadJs(url,callback,errcallback,charset,callbackFunctionName){
	charset = charset?charset:"GB2312";
	var cFN = callbackFunctionName?callbackFunctionName:"callback";

	if(Browser.isIE){
		var df = document.createDocumentFragment();    
        df[cFN] = function(data){
			s.onreadystatechange = df =null;
			try{if(callback)callback(data);
			}catch(e){if(e.number == -2146823277) return;status = e.message;setTimeout("status=''",3000);}
		}
		var s = df.createElement("SCRIPT");
		s.charset = charset;
		df.appendChild(s);
		s.onreadystatechange = function(){
			if(s.readyState=="loaded") {
				s.onreadystatechange=df = null;
				try{if (errcallback) errcallback({error:{msg:"服务器繁忙，请稍后再试.",type:900}});
				}catch(e){if(e.number != -2146823277)status=e.message;	setTimeout("status=''",3000);}
			}
		}
		s.src = url;
	}else{
		var i = document.createElement("IFRAME");    
		i.style.display = "none";
		i.callback = function(data){callback(data); i.callback = null; i.src="about:blank"; removeElement(i); i = null;};
		i.errcallback = errcallback;
		i.src="javascript:\"<script>function " + cFN + "(data){frameElement.callback(data)};<\/script><script src='"+url+"' charset='" + charset + "'><\/script><script>setTimeout('frameElement.errcallback({error:{msg:\"服务器繁忙，请稍后再试.\",type:900}})',0)<\/script>\"";
        try{document.body.appendChild(i);}catch(e){status="请等待网页加载完成再进行操作!";setTimeout("status=''",3000);}
	}
}
]]></JsLoader><AjaxMethod author="心云意水" date="2007.1.17" common="xinyunyishui@eyou.com"><![CDATA[<script type="text/javascript">
<!--

/*****************************************************************************
 *                     XMLHTTP请求类
 *属性：
 *       ethod(String)：请求方法，POST或者GET，默认为GET
 *         url(String)：请求URL，默认为空
 *      async(Boolean)：是否异步，true为异步，false为同步，默认为true
 *     content(String)：请求的内容，如果请求方法为POST需要设定此属性，默认为空
 *  callback(Function)：回调函数，即返回响应内容时调用的函数，默认为直接返回。
 *                      回调函数有一个参数为XMLHttpRequest对象，即定义回调函数
 *                      时要这样：function callBackFunction(XMLHttpRequest)
 *                                  {alert(XMLHttpRequest.responseText);}
 *方法：
 *  send()：发送XMLHTTP请求，无参数
 *
 *作者：心云意水
 *时间：2007.1.17
 *Email:xinyunyishui@eyou.com
 ****************************************************************************/
function eyunXMLHttp(){
    var xmlHttpObj=false;
    var ObjSelf=this;
    try {xmlHttpObj=new ActiveXObject("Microsoft.XMLHTTP");}
    catch(e){
        try{xmlHttpObj=new ActiveXObject("MSXML2.XMLHTTP");}
        catch(e1){
            try{xmlHttpObj=new XMLHttpRequest;}
            catch(e2){xmlHttpObj=false;
            }
        }
    }
    if (!xmlHttpObj){
        throw(new Error(-1,"无法创建XMLHTTP连接对象！"));
        return false;
    }
    this.method="GET";
    this.url;
    this.async=true;
    this.content="";
    this.callback=function(xhr){return;}
    this.send=function(){
        if(!this.method||!this.url||!this.async){
            throw(new Error(-1,"method、url、async属性不能为空！"));
        return false;
        }
        xmlHttpObj.open(this.method,this.url,this.async);
        if(this.method=="POST")
            xmlHttpObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        xmlHttpObj.onreadystatechange=function(){
            if(xmlHttpObj.readyState==4)
                if(xmlHttpObj.status==200)
                    ObjSelf.callback(xmlHttpObj);
                else
                    throw(new Error(-1,"页面读取错误！"));
        }
        if(this.method=="POST")
            xmlHttpObj.send(this.content);
        else
            xmlHttpObj.send(null);
    }
}//-->
</script>]]></AjaxMethod><selection author="" date="" common=""><![CDATA[<textarea rows="7" cols="49" id="box">123456789
101112
</textarea> 
<script type="text/javascript">
function setCursorPosition(object, start, end) {

	if (object.setSelectionRange) {

		object.focus();

		object.setSelectionRange(start, end);

	} else if (object.createTextRange) {

		var range = object.createTextRange();

		range.collapse(true);
		range.moveEnd("character", end);
		range.moveStart("character", start);

		range.select();

	}

}
window.onload = function () {
	setCursorPosition(document.getElementById("box"), 1, 1);
};
</script>]]></selection><selection author="" date="" common=""><![CDATA[<script language=javascript>
function sel(obj){
    var s=(window.getSelection)?window.getSelection():document.selection.createRange();
    if(obj.createTextRange){
        s.setEndPoint("StartToStart",obj.createTextRange());
    }else{
        (!!s.toString())&&s.getRangeAt(0).setStart(document.body.firstChild, 0); 
    }
    (s.text)&&(alert(s.text),1)||alert(s);
}
</script>

<div>
我们可以用window.getselection()得到选择区域，可是有时候我们需要对未选择的区域进行操作，当然与选择区域有关，比如说，选择区域为多行，但是首行未占满，我想得到的区域为选择区域以及选择区域的首行没有选择的部分？？？？急！！！
</div>

<button onclick='sel(document.body);'>check selection</button>
]]></selection><attachEvent author="MZ" date="" common=""><![CDATA[if(!window.attachEvent && window.addEventListener)
{
  window.attachEvent = HTMLElement.prototype.attachEvent=
  document.attachEvent = function(en, func, cancelBubble)
  {
    var cb = cancelBubble ? true : false;
    this.addEventListener(en.toLowerCase().substr(2), func, cb);
  };
  window.detachEvent = HTMLElement.prototype.detachEvent=
  document.detachEvent = function(en, func, cancelBubble)
  {
    var cb = cancelBubble ? true : false;
    this.removeEventListener(en.toLowerCase().substr(2), func, cb);
  };
}
]]></attachEvent><attachEvent author="FS" date="" common=""><![CDATA[(function () {
	if (! window.HTMLElement) return;
	function _attach_event_ (sName, fHandler) {
		if ("function" != typeof fHandler) return;
		sName = sName.replace(/^on/, "");
		fHandler[sName] = function(e){
			return fHandler();
		}
		this.addEventListener(sName, fHandler[sName], false);
	}
	function _detach_event_ (sName, fHandler) {
		if ("function" != typeof fHandler) return;
		sName = sName.replace(/^on/, "");
		if(typeof(fHandler[sName]) == "function") {
			this.removeEventListener(sName, fHandler[sName], false);
		}
		else {
			this.removeEventListener(sName,fHandler,true);
		}
		fHandler[sName] = null;
	}
	var _e = HTMLElement.prototype;
	var _d = Document.prototype;
	_e.attachEvent = _attach_event_;
	_e.detachEvent = _detach_event_;
	_d.attachEvent = _attach_event_;
	_d.detachEvent = _detach_event_;
})();
]]></attachEvent><SwapVar author="" date="" common=""><![CDATA[<script type="text/javascript">
var a=1,b=2;
a=[b,b=a][0];
alert(a+","+b);
</script>]]></SwapVar><dichotomy author="" date="" common="二分法示例"><![CDATA[<script>
//var a=new Array(3,6,8,10,12,15,16,18,21,25,30);
var a=["张大头","李大头","杜大头","林大头","王大头","郑大头","陈大头","黄大头"].sort();
document.write(a+"<br/>");
function seach(n){
	var low=0,mid,high=a.length-1;
	document.write("low:"+low+" mid:"+mid+" high:"+high+"<br/>");
	while(low <= high){
		//取中间值；
		mid = Math.floor((low + high) / 2);
		document.write("mid:"+mid+" ");
		if (a[mid]==n){//如果中间值与目标数相等，返回中间值；
                                   return n+"的索引值是："+mid;
                                }
		if (a[mid]<n){//如果中间数比目标数小，high不变，则low为中间值+1，舍去小数部分；
                                   low = mid+1;
		}else{//否则，low不变，high为中间值-1，舍去大数部分；
                                   high = mid-1;
                                }
		document.write("low:"+low+" ");
		document.write("high:"+high+"<br/>");
	}
	return -1;
}
document.write(seach("张大头"));
</script>]]></dichotomy><byIdAndbyName author="wc" date="" common="byId和byName的不同表现"><![CDATA[<input name="wc" value="1" />
<div id="wc">2</div>
<input id="wc" value="3"><br />
<span id="wc">4</span><br />
<input name="wc" value="5" /><br />
<input name="wc" value="6" />
<!--
document.getElementById(xx)
是取一些ID为xx的元素对象（DOM对象）
不过IE和FireFox里会有差距，因为IE也取name=xx的元素。。
比如下面的代码
IE和Opera里显示的是1
FireFox里显示的则是2
-->
<!--
document.getElementsByName(xx)
是取一些name为xx的元素对象的集合的索引（DOM对象的索引，注意这里因为是返回索引，所以当元素发生变化时索引也跟着变化）
集合就是和数组类似的对象具有0-n属性和length属性
同上IE和FireFox里会有差距，因为IE也取id=xx的元素
-->
<script type="text/javascript">
var o = document.getElementById("wc");
alert(o.innerHTML||o.value);//IE和Opera里显示的是1，FireFox里显示的则是2
var o = document.getElementsByName("wc");
alert(o.length); //即IE/OP = 6，FF=3 因为FF不会理睬id = wc的元素
var input = document.createElement("input");
input.id = "wc";
document.body.appendChild(document.createElement("br")); //加个换行，不用理睬:D
document.body.appendChild(input); //添加一个input元素并且该元素id = wc
alert(o.length); //即IE/OP = 7 因为id会被检测的到，FF=3
input = document.createElement("input");
input.name = "wc";
document.body.appendChild(document.createElement("br")); //加个换行，不用理睬:D
document.body.appendChild(input); //在加一个input元素并且该元素name = wc
alert(o.length); //即IE = 7 IE没有检测name属性，OP = 8 OP有检测name属性，FF = 4 FF也有检测name属性:D
//如果没有找到对象的话的情况;
alert(document.getElementById("muxrwc")); //null
alert(document.getElementsByName("muxrwc")); //object length = 0
</script>]]></byIdAndbyName><datetime author="" date="" common="日期与时间"><![CDATA[如何判断2个日期之间相隔几个月?
年数相减*12+月数相减+((date相减>=0)?0:-1)

不考虑天数:
年数相减*12+月数相减

得到某月的天数:
alert(new Date(2007,12,0).getDate())
2007,12,0 : 十二月份的最后一天


今天是本月的第几周
今天是本年的第几周
<script type="text/javascript">
var getMonthWeek = function (a, b, c) {
/*
a = d = 当前日期
b = 6 - w = 当前周的还有几天过完（不算今天）
a + b 的和在除以7 就是当天是当前月份的第几周
*/
    var date = new Date(a, parseInt(b) - 1, c), w = date.getDay(), d = date.getDate();
    return Math.ceil(
        (d + 6 - w) / 7
    );
};

var getYearWeek = function (a, b, c) {
/*
date1是当前日期
date2是当年第一天
d是当前日期是今年第多少天
用d + 当前年的第一天的周差距的和在除以7就是本年第几周
*/
    var date1 = new Date(a, parseInt(b) - 1, c), date2 = new Date(a, 0, 1),
        d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
    return Math.ceil(
        (d + ((date2.getDay() + 1) - 1)) / 7
    );
};

document.write(
    "今天是本月的第 ", getMonthWeek(2007, 10, 17), " 周<br \/>"
    , "今天是本年的第 ", getYearWeek(2007, 10, 17), " 周"
);
</script> 

<script language="JavaScript">
<!--
//程序:常用公历日期处理程序
//作者:梅雪香(meixx)
//时间:忘了
/**//*用相对不规则的字符串来创建日期对象,不规则的含义为:顺序包含年月日三个数值串,有间隔*/
String.prototype.parseDate = function(){
    var ar = (this + ",0,0,0").match(/\d+/g);
    return ar[5]?(new Date(ar[0],ar[1]-1,ar[2],ar[3],ar[4],ar[5])):(new Date());
}

/**//*
 * 功能:根据输入表达式返回日期字符串
 * 参数:dateFmt:字符串,由以下结构组成    
 *      yy:长写年,YY:短写年mm:数字月,MM:英文月,dd:日,hh:时,
 *      mi:分,ss秒,ms:毫秒,we:汉字星期,WE:英文星期.
 *      isFmtWithZero : 是否用0进行格式化,true or false
 * 返回:对应日期的中文字符串
*/
Date.prototype.toString = function(dateFmt,isFmtWithZero){
    dateFmt = (dateFmt == null ? "yy-mm-dd hh:mi:ss" : dateFmt);
    if(typeof(dateFmt) != "string" )
        throw (new Error(-1, 'toString()方法的第一个参数为字符串类型!'));
    isFmtWithZero = !!isFmtWithZero;
    var weekArr=[["日","一","二","三","四","五","六"],["SUN","MON","TUR","WED","THU","FRI","SAT"]];
    var monthArr=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];
    var str=dateFmt;
    var o = {
        "yy" : this.getFullYear(),
        "YY" : this.getYear(),
        "mm" : this.getMonth()+1,
        "MM" : monthArr[this.getMonth()],
        "dd" : this.getDate(),
        "hh" : this.getHours(),
        "mi" : this.getMinutes(),
        "ss" : this.getSeconds(),
        "we" : "星期" + weekArr[0][this.getDay()],
        "WE" : weekArr[1][this.getDay()]
    }
    for(var i in o){
        str = str.replace(new RegExp(i,"g"),o[i].toString().fmtWithZero(isFmtWithZero));
    }
    str = str.replace(/ms/g,this.getMilliseconds().toString().fmtWithZeroD(isFmtWithZero));
    return str;
}
/**//*将一位数字格式化成两位,如: 9 to 09*/
String.prototype.fmtWithZero = function(isFmtWithZero){    
    return (isFmtWithZero && /^\d$/.test(this))?"0"+this:this;
}
String.prototype.fmtWithZeroD = function(isFmtWithZero){    
    return (isFmtWithZero && /^\d{2}$/.test(this))?"00"+this:((isFmtWithZero && /^\d$/.test(this))?"0"+this:this);
}

/**//* 功能 : 返回与某日期相距N天(N个24小时)的日期
 * 参数 : num number类型 可以为正负整数或者浮点数,默认为1;
 *        type 0(秒) or 1(天),默认为天
 * 返回 : 新的Date对象
 */
Date.prototype.dateAfter=function(num,type){
    num = (num == null?1:num);
    if(typeof(num)!="number") throw new Error(-1,"dateAfterDays(num,type)的num参数为数值类型.");
    type = (type==null?1:type);
    var arr = [1000,86400000];
    return new Date(this.valueOf() + num*arr[type]);
}

//判断是否是闰年,返回true 或者 false
Date.prototype.isLeapYear = function (){
    var year = this.getFullYear();
    return (0==year%4 && ((year % 100 != 0)||(year % 400 == 0)));
}

//返回该月天数
Date.prototype.getDaysOfMonth = function (){
    return (new Date(this.getFullYear(),this.getMonth()+1,0)).getDate();
}

//日期比较函数,参数date:为Date类型,如this日期晚于参数:1,相等:0 早于: -1
Date.prototype.dateCompare = function(date){
    if(typeof(date) != "object" || !(/Date/.test(date.constructor)))
         throw new Error(-1,"dateCompare(date)的date参数为Date类型.");
    var d = this.getTime() - date.getTime();
    return d>0?1:(d==0?0:-1);
}

/**//*功能:返回两日期之差
 *参数:pd   PowerDate对象
 *    type: 返回类别标识.yy:年,mm:月,ww:周,dd:日,hh:小时,mi:分,ss:秒,ms:毫秒
 *    intOrFloat :返回整型还是浮点型值 0:整型,不等于0:浮点型
 *    output : 输出提示,如:时间差为#周!
 */
Date.prototype.calDateDistance = function (date,type,intOrFloat,output){
    if(typeof(date) != "object" || !(/Date/.test(date.constructor)))
         throw new Error(-1,"calDateDistance(date,type,intOrFloat)的date参数为Date类型.");
    type = (type==null?'dd':type);
    if(!((new RegExp(type+",","g")).test("yy,mm,ww,dd,hh,mi,ss,ms,")))
         throw new Error(-1,"calDateDistance(pd,type,intOrFloat,output)的type参数为非法.");
    var iof = (intOrFloat==null?0:intOrFloat);
    var num=0;
    var o = {
        "ww" : 7*86400000,
        "dd" : 86400000,
        "hh" : 3600000,
        "mi" : 60000,
        "ss" : 1000,
        "ms" : 1
    }
    switch(type){
        case "yy": num = this.getFullYear() - date.getFullYear(); break;
        case "mm": num = (this.getFullYear() - date.getFullYear())*12+this.getMonth()-date.getMonth(); break;
        default: 
            var sub = this.valueOf() - date.valueOf();
            if (o[type])
                num = (sub/o[type]).fmtRtnVal(iof);
            break;
    }
    return (output ? output.replace(/#/g," "+num+" ") : num);
}
//返回整数或者两位小数的浮点数
Number.prototype.fmtRtnVal = function (intOrFloat){
    return (intOrFloat == 0 ? Math.floor(this) : parseInt(this*100)/100);
}
//根据当前日期所在年和周数返回周日的日期
Date.prototype.RtnByWeekNum = function (weekNum){
    if(typeof(weekNum) != "number")
        throw new Error(-1,"RtnByWeekNum(weekNum)的参数是数字类型.");
    var date = new Date(this.getFullYear(),0,1);
    var week = date.getDay();
    week = (week==0?7:week);
    return date.dateAfter(weekNum*7-week,1);
}
//根据日期返回该日期所在年的周数
Date.prototype.getWeekNum = function (){
    var dat = new Date(this.getFullYear(),0,1);
    var week = dat.getDay();
    week = (week==0?7:week);
    var days = this.calDateDistance(dat,"dd")+1;
    return ((days + 6 - this.getDay() - 7 + week)/7);
}

//-->
</script>

<script language="JavaScript">
<!--
var dw = document.write;
var date2 = "2005-12-30".parseDate();
dw(date2,"<br>");
var date3 = "2006-1-10 11 11 11".parseDate();
dw(date2.calDateDistance(date3,null,null,"时间差为#天!"));
//alert(new Date(2000,2,-29));
//-->
</script>]]></datetime><closeAreaOpenedWindow author="" date="" common="关闭链接打开的新窗口"><![CDATA[<a href="javascript:top.close();" target="_blank">asdf</a>
<a href="javascript:window.close();" target="_blank">asdf</a>]]></closeAreaOpenedWindow><predefined author="" date="" common="预定义"><![CDATA[<script>
c();
t=function c(){alert('test c')}
t();
</script>]]></predefined><applycall author="WC" date="2007-12-11" common=""><![CDATA[<script type="text/javascript">
if ("function" != typeof Function.prototype.apply) {
//Meizz apply and call (梅老师写的兼容方法)
//如果浏览器版本过低不支持apply和call的话 - -!
    Function.prototype.apply = function (obj, argu) {
    //apply函数兼容
        var a = [], f = null, i = 0;
        if (argu && argu.constructor === Array) for (; i < argu.length ; i ++) a[i] = "argu[" + i + "]";
        //把这个被apply的函数追到自己的原型对象中，这样就调用一下这个函数，就可以实现继承里面所有的引用。
        if (obj) obj.constructor.prototype.___caller = this;
        f = eval((obj ? "obj.___caller" : "this") + "(" + a.join(",") + ");");
        //用完了，就删除掉它
        if (obj) delete obj.constructor.prototype.___caller;
        return f;
    };
    Function.prototype.call = function (obj) {
    //call函数兼容
        for (var a = [], i = 1 ; i < arguments.length ; i ++) a[i - 1] = arguments[i];
        return this.apply(obj, a);
    };
}
</script>]]></applycall><AddFavorite author="wc" date="" common="添加到收藏夹，兼容热点"><![CDATA[<script type="text/javascript">
var address = function (obj, url, title) {
/*
嘿嘿，从BlueDestiny的BLOG里搜刮了一篇添加收藏夹的代码，不过那个貌似偶合太高。。
看的迷糊。。所以单独做出来了。。。并且可以兼容热点使用。。。
BlueDestiny前辈的源文：http://www.never-online.net/blog/article.asp?id=108
*/
    var e = window.event || arguments.callee.caller.arguments[0];
    
    var B = {
        IE : /MSIE/.test(window.navigator.userAgent) && !window.opera
        , FF : /Firefox/.test(window.navigator.userAgent)
        , OP : !!window.opera
    };
    
    obj.onmousedown = null;
    
    if (B.IE) {
        obj.attachEvent("onmouseup", function () {
            try {
                window.external.AddFavorite(url, title);
                window.event.returnValue = false;
            } catch (exp) {}
        });
    } else {
        if (B.FF || obj.nodeName.toLowerCase() == "a") {
            obj.setAttribute("rel", "sidebar"), obj.title = title, obj.href = url;
        } else if (B.OP) {
            var a = document.createElement("a");
            a.rel = "sidebar", a.title = title, a.href = url;
            obj.parentNode.insertBefore(a, obj);
            a.appendChild(obj);
            a = null;
        }
    }
};
</script>
<img src="http://hi.csdn.net/images/csdnlogo.gif" alt="" width="280" height="60" border="0" usemap="#Map" />
<map name="Map">
<area shape="rect" coords="25,14,258,49" onMouseDown="address(this, 'http://www.never-online.net/', 'BlueDestiny前辈的BLOG')" />
</map>
<a href="javascript:void(0);" onMouseDown="address(this, 'http://www.never-online.net/', 'BlueDestiny前辈的BLOG')">添加</a>]]></AddFavorite><borderStyle author="" date="" common=""><![CDATA[<style type="text/css">
/*菜单样式*/      
#dhmenu {height:20px;list-style:none;margin:0;padding:0;}      
#dhmenu li {height:18px;float:left;margin:0 1px;padding:0;}      
#dhmenu li a {cursor:default;height:18px;outline:none;padding-left:10px;color:#000;text-decoration:none;background-color:buttonface;float:left;border:1px solid buttonface;}      
#dhmenu li a span {height:18px;line-height:18px;cursor:default;padding-right:10px;background-color:buttonface;float:left;}      
#dhmenu li a:hover {border:1px outset;}      
</style>

</head>

<ul id="dhmenu">
	<li onmousedown="this.childNodes[0].style.borderStyle='inset'" onmouseup="this.childNodes[0].style.borderStyle='';"><a href="javascript:void(0);" onclick="return false"><span>test</span></a></li>
</ul>]]></borderStyle><ScrollToEndFireEvent1times author="WC" date="" common="Scroll到底部只触发一次事件"><![CDATA[<script>
var timer = 0;
function test(obj){	
	if (timer) window.clearTimeout(timer);
	timer = window.setTimeout(function () {
		timer = 0;
		var osh = parseInt(obj.scrollHeight);
		var ost = parseInt(obj.scrollTop);
		var ooh = parseInt(obj.offsetHeight);
		if(osh-ost==ooh){
			alert('do something');
		}
	}, 0);
}
</script>

<div style="background-color:gray;width:200px;height:200px;overflow:auto;" onscroll="test(this);">
<div style="width:100px;height:600px;overflow:auto;">&nbsp;</div>
</div>]]></ScrollToEndFireEvent1times>
	<predefined author="CSDN zhys9" date="" common=""><![CDATA[<script>
function   f()   { 
alert(a); 
var   a   =   'a'; 
} 

f();

function   f()   { 
var   a=new String; 
alert(a); 
a   =   'a'; 
}
f();
</script>]]></predefined><tempcode author="" date="" common=""><![CDATA[<script>
function getexp(exp){
	var tmpexp;
	tmpexp = exp.replace(/A/g,30).replace(/B/g,12.5).replace(/C/g,27);
	tmpexp = tmpexp.replace(/avg\((.*)\)/i,function(o){return o.replace(/\,/g,"+").replace(/avg/i,"")+"/"+(o.split("\,").length)});
	tmpexp = tmpexp.replace(/sum\((.*)\)/i,function(o){return '(function(){var tmpv=0;tmpv += '+o.replace(/sum/i,"").replace(/\)/,");return tmpv;})()")});

	if(/(sum)|(avg)/ig.test(exp)){
		return getexp(tmpexp)
	}else{
		return tmpexp;
	}
}

var tempexp = "avg(sum(A*B),sum(B*C),sum(A*C))";
var tmpno = getexp(tempexp);
alert(tmpno);
alert(eval(tmpno));
</script>]]></tempcode><tobits author="dh" date="" common="四舍五入保留N位小数"><![CDATA[<script>
function tobits(flt,n){
	if(parseFloat(flt) == flt){
		var t = 1+new Array(n+1).join("0");
		return Math.round(flt * t) / t ;
	}else{
		return 0;
	}
}

alert(tobits(108.3383533337,2));
alert(tobits(108.3383533337,4));
alert(tobits(108.3383533337,9));
</script>]]></tobits><containCompare author="" date="" common=""><![CDATA[<script type="text/javascript">
//比较两串，长串必须包含短串中所有字符，重复字符计一字符；如果串长一样则必须每一字符都相同；
function comp(a,b){
    if(a.length==b.length) return a.split("").sort().join("")==b.split("").sort().join("");
    a = a.split("").sort().join("").replace(/(.)\1+/g,"$1");
    b = b.split("").sort().join("").replace(/(.)\1+/g,"$1");
    var arr = a.split("");
    var re = new RegExp(arr.join("|"),"g");
    return (b.length - b.replace(re,"").length == a.length || b.replace(re,"").length==0)
}
//数组的比较
function compArr(a,b){
    if(a.length==b.length) return a.sort().join("")==b.sort().join("");
    a = a.sort().join("").replace(/(.)\1+/g,"$1");
    b = b.sort().join("").replace(/(.)\1+/g,"$1");
    var arr = a.split("");
    var re = new RegExp(arr.join("|"),"g");
    return (b.length - b.replace(re,"").length == a.length || b.replace(re,"").length==0)
}

var a = ["1","2","3"];
var b = ["1","3"];

alert(compArr(a,b));

alert(comp("ab","b"));

</script>]]></containCompare><containCompare author="" date="" common=""><![CDATA[<script type="text/javascript">
//针对大数字比较
function compArr(a,b){
    if(a.length==b.length) return a.sort().join("")==b.sort().join("");
    var arr = a.slice(0);
    a = a.sort().join(",");
    b = b.sort().join(",");
    var re = new RegExp(arr.join(",|"),"g");
    return (b.length - b.replace(re,"").length == a.length || b.replace(re,"").length==0)
}

var a = ["100","200","300"];
var b = ["100","300"];

alert(compArr(a,b));
</script>]]></containCompare><charset author="wc" date="" common=""><![CDATA[<script type="text/javascript">
var to16 = {

    on : function (str) {
        var a = [], i = 0;
        
        for (; i < str.length ;) a[i] = ("00" + str.charCodeAt(i ++).toString(16)).slice(-4);
        
        return "\\u" + a.join("\\u");
    },
    
    un : function (str) {
        return unescape(str.replace(/\\/g, "%"));
    }
    
};
var str = to16.on("test");
var str2 = to16.un("\u0074\u0065\u0073\u0074 ");
document.write(str+"<br/>");
document.write(str2+"<br/>");
</script>
]]></charset><IframeScrollCompatible author="" date="" common="iframe滚动兼容"><![CDATA[<html> 
    <head>                             
      <title>iframe滚动兼容测试</title> 
      <meta http-equiv="content-type" content="text/html;charset=gb2312" /> 
      <script type="text/javascript"> 
                function mydoscroll(evenName){ 
                        Iframe=document.getElementById("IframeID"); 
                        if(Iframe.document   &&   Iframe.document.body.doScroll){
                                Iframe.contentWindow.document.documentElement.doScroll(evenName); 
                        }else{                   
                                if(evenName=="pageUp"){ 
                                        Iframe.contentWindow.scrollByPages(-1); 
                                } 
                                if(evenName=="pageDown"){ 
                                        Iframe.contentWindow.scrollByPages(1); 
                                } 
                                if(evenName=="up"){ 
                                        Iframe.contentWindow.scrollByLines(-1); 
                                } 
                                if(evenName=="down"){ 
                                        Iframe.contentWindow.scrollByLines(1);
                                } 
                      } 
              }     
        </script> 
    </head> 
    <body> 
          <h1>iframe滚动兼容测试</h1> 
          <iframe id="IframeID" width="100%" height="100" frameborder="0" src="http://www.jslab.org.cn"></iframe> 
          <input type="button" value="向上翻页" onClick="mydoscroll('pageUp')"> 
          <input type="button" value="向上" onClick="mydoscroll('up')"> 
          <input type="button" value="向下" onClick="mydoscroll('down')"> 
          <input type="button" value="向下翻页" onClick="mydoscroll('pageDown')"> 
    </body> 
</html>]]></IframeScrollCompatible><regexpreplace author="" date="" common=""><![CDATA[<script type="text/javascript">
var string = "我是一个字符串啊咿呀咿呀呦";
string.replace(/(.)./g, function () {
/*
REPLACE第二个参数为函数，则传递给此函数的形式参数如下，并且不会影响Global的RegExp对象
arguments[arguments.length] = RegExp.lastMatch

---
如果有捕获的情况则
arguments[arguments.length] = RegExp.$1
arguments[arguments.length] = RegExp.$2
....
---

arguments[arguments.length] = RegExp.input
arguments[arguments.length] = RegExp.input
*/
    for (var arg = arguments, ary = [], i = 0 ; i < arg.length ; i ++)
        ary.push("arguments[" + i + "] = " +  arg[i]);
    alert(ary.join("\n"));
});
</script> ]]></regexpreplace><regexpreplace author="" date="" common=""><![CDATA[<script>
var str = 'aaa';
var s = str.replace(/a/g,
function($$,mathIndex,input){
    var ar = [];
    for(var i=0;i<arguments.length;i++){
        ar.push(arguments[i]); alert(ar);
    }
    return mathIndex;
}
);
alert(s);
</script> ]]></regexpreplace><extendall author="" date="" common=""><![CDATA[<script type="text/javascript">
var 疑问 = function () {

	var 我要独立 = "可以";
	
	this.set = 疑问.prototype.set = function () {
		我要独立 = "不可以";
	};
	
	this.get = 疑问.prototype.get = function () {
		return 我要独立;
	};
	
};

var 测试 = function () {
	return 疑问.call(this);
};

var 实例1 = new 测试;

var 实例2 = new 测试;

实例1.set();

alert(实例1.get() + "\n" + 实例2.get());
alert(实例1.set === 实例2.set);
</script> ]]></extendall><extendall author="" date="" common=""><![CDATA[<script type="text/javascript">
Object.extend = function (a, b) {
	for (var i in b) a[i] = b[i];
	return a;
};

var 疑问 = function () {

	var 我要独立 = "可以";
	
	疑问.prototype.set = function () {
		我要独立 = "不可以";
	};
	
	疑问.prototype.get = function () {
		return 我要独立;
	};
	
};

var 测试 = function () {
	Object.extend(this, new 疑问);
};
测试.prototype.constructor = 疑问;

var 实例1 = new 测试;

var 实例2 = new 测试;

实例1.set();

alert(实例1.get() + "\n" + 实例2.get());
alert(实例1.get === 实例2.get);
</script>]]></extendall><JsLoader author="WC" date="" common=""><![CDATA[var jsLoad = function (url, exectime, charset, callback, errcallback) {
//加载script
	try {
		var wc = document.createElement("script"), exectime = exectime || 3000, timer = 0, speed = 100, clear = function () {
			wc.parentNode.removeChild(wc);
			window.clearInterval(timer);
		};
		
		wc.type = "text/javascript";
		wc.charset = charset || "gb2312";
		wc.src = url;
		document.getElementsByTagName("head")[0].appendChild(wc);
		
		timer = window.setInterval(function () {
			if (exectime > 0) {
				exectime -= speed;
				try {
					if (callback) callback();
					clear();
				} catch (exp) {}
			} else {
				if (errcallback) errcallback();
				clear();
			}
		}, speed);
		
	} catch (exp) {
		alert("head还未加载...");
	}
};]]></JsLoader><DhtmlChart author="EMU" date="" common=""><![CDATA[<HTML>   
  <HEAD>   
  <TITLE>画图</TITLE>   
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">   
  <META   NAME="Generator"   CONTENT="EditPlus">   
  <META   NAME="Author"   CONTENT="emu">   
  <META   NAME="Keywords"   CONTENT="chart   javascript">   
  <META   NAME="Description"   CONTENT="emu's   dhtml   chart">   
  <SCRIPT   LANGUAGE="JavaScript">   
  <!--   
  function   drawLine(x0,y0,x1,y1,color){   
  var   rs   =   "";   
  if   (y0   ==   y1)     //画横线   
  {   
  if   (x0>x1){var   t=x0;x0=x1;x1=t}       
  rs   =   "<p   class=emuH   style='top:"+y0+";left:"+x0+";background-color:"+color+";   width:"+Math.abs(x1-x0)+"'/>";   
  }   
  else   if   (x0   ==   x1)     //画竖线   
  {   
  if   (y0>y1){var   t=y0;y0=y1;y1=t}     
  rs   =   "<p   class=emuW   style='top:"+y0+";left:"+x0+";background-color:"+color+";height:"+Math.abs(y1-y0)+"'/>";   
  }   
  else   
  {   
  var   lx   =   x1-x0   
  var   ly   =   y1-y0   
  var   l   =   Math.sqrt(lx*lx+ly*ly)   
  rs   =   new   Array();   
  for   (var   i=0;i<l;i+=1)   
  {   
  var   p   =   i/l;   
  var   px   =   parseInt(x0   +   lx*p);   
  var   py   =   parseInt(y0   +   ly*p);   
  rs[rs.length]   =   "<p   class=emuWH   style='top:"+py+";left:"+px+";background-color:"+color+"'/>";   
  }   
  rs   =   rs.join("");   
  }   
  return   rs   
  }   
  function   drawRectangle(x0,y0,x1,y1,color,title)   
  {   
  if   (x0   ==   x1   ||   y0   ==   y1)   return;   
  if   (x0>x1)   {var   t=x0;x0=x1;x1=t}   
  if   (y0>y1)   {var   t=y0;y0=y1;y1=t}   
  return   "<table   style='top:"+y0+";left:"+x0+";position:absolute'   title="+title+"><td   bgcolor="+color+"   width="+(x1-x0)+"   height="+(y1-y0)+">&nbsp;</td></table>";   
  }   
  function   outText(x0,y0,text,fontSize,color){   
  return   "<p   style='top:"+y0+";left:"+x0+";position:absolute;color:"+color+";font-size:"+fontSize+"'>"+text+"</p>";   
  }   
  var   points   =   new   Array(1000);   
  function   drawPie(x0,y0,radius,startAngle,endAngle,color){   
  if   (points.length<radius<<2)   points.length=radius<<2;   
  var   startAngle   =   startAngle*Math.PI/180;   
  var   endAngle   =   endAngle*Math.PI/180;   
  var   maxX=0,maxY=0,minX=0,minY=0;   
  var   pointsLength   =   0;   
  var   lines   ;   
  //   get   arc   points   
  var   step   =   1/radius;   
  for   (var   i=startAngle;i<endAngle;i+=step){   
  var   x   =   Math.round(Math.sin(i)*radius);   
  var   y   =   Math.round(Math.cos(i)*radius)   
  points[pointsLength++]=[x,y];   
  if   (maxX<x)   maxX=x;   
  if   (minX>x)   minX=x;   
  if   (maxY<y)   maxY=y;   
  if   (minY>y)   minY=y;   
  }   
    
  //   get   radius   points   
  var   dx1=Math.sin(startAngle)*radius;   
  var   dy1=Math.cos(startAngle)*radius;   
  var   dx2=Math.sin(endAngle)*radius;   
  var   dy2=Math.cos(endAngle)*radius;   
  var   L   =   Math.sqrt(dx1*dx1+dy1*dy1);   
  var   stepx1   =   dx1/L   ,   stepy1   =   dy1/L   ,stepx2   =   dx2/L   ,   stepy2   =   dy2/L   ;   
  for   (var   i=0;i<L;i+=.99){   
  points[pointsLength++]   =   [Math.round(stepx1*i),Math.round(stepy1*i)]   
  points[pointsLength++]   =   [Math.round(stepx2*i),Math.round(stepy2*i)]   
  }   
    
  var   dx   =   maxX-minX+1;   
  var   dy   =   maxY-minY+1;   
  if   (dx>dy){   
  lines   =   new   Array(dy);   
  for   (var   i=pointsLength-1;i>-1;i--){   
  var   p0   =   points[i];   
  var   px   =   p0[0];   
  var   y   =   p0[1]-minY;   
  if   (lines[y]){   
  if   (lines[y][0]>px)   //left   point   
  lines[y][0]   =   px;   
  if   (lines[y][1]<px)   //right   point   
  lines[y][1]   =   px;   
  }else{   
  lines[y]=[px,px];   
  }   
  }   
  for   (var   i=dy-1;i>-1;i--){   
  var   left   =   lines[i][0];   
  lines[i]   =     "<p   class=emuH   style='top:"+(i+minY+y0)+";left:"+(left+x0)+";width:"+(lines[i][1]-left)+";background-color:"+color+"'/>";   
  }   
  }else{   
  lines   =   new   Array(dx);   
  for   (var   i=pointsLength-1;i>-1;i--){   
  var   p0   =   points[i];   
  var   py   =   p0[1];   
  var   x   =   p0[0]-minX;   
  if   (lines[x]){   
  if   (lines[x][0]>py)   //top   point   
  lines[x][0]   =   py;   
  if   (lines[x][1]<py)   //buttom   point   
  lines[x][1]   =   py;   
  }else{   
  lines[x]=[py,py];   
  }   
  }   
  for   (var   i=dx-1;i>-1;i--){   
  var   top   =   lines[i][0];   
  lines[i]   =     "<p   class=emuW   style='left:"+(i+minX+x0)+";top:"+(top+y0)+";height:"+(lines[i][1]-top)+";background-color:"+color+"'/>";   
  }   
  }   
  return   lines.join("");   
  }   
  function   drawArc(x0,y0,radius,startAngle,endAngle,color,step){   
  if   (step   ==   null   ||   isNaN(step))   step=1;   
  rs   =   new   Array();   
  tmpar   =   new   Array();   
  startAngle   =   startAngle/180*Math.PI;   
  endAngle   =   endAngle/180*Math.PI;   
  for   (var   i=startAngle;i<endAngle;i+=(step/radius))   
  {   
  var   dx   =   parseInt(Math.sin(i)*radius+x0);   
  var   dy   =   parseInt(Math.cos(i)*radius+y0);   
  rs[rs.length]   =   "<p   class=emuWH   style='top:"+dy+";left:"+dx+";background-color:"+color+"'/>";   
  }   
  return   (rs.join(""));   
  }   
  function   fixTo(s,i){   
  if   (s==null   ||   s==""   ||   isNaN(s)   ||   Math.round(s)==0)   return   0;   
  i   =   Math.round(i);   
  if   (i==0)   return   Math.round(s);   
  if   (i==null   ||   isNaN(i)   ||   i<0)   i=2;   
  var   v   =   Math.round(s*Math.pow(10,i)).toString();   
  if   (/e/i.test(v))   return   s;   
  return   v.substr(0,v.length-i)+"."+v.substr(v.length-i);   
  }   
    
  //-->   
  </SCRIPT>   
<style>   
  .emuW{position:absolute;font-size:1px;width:1}   
  .emuH{position:absolute;font-size:1px;height:1}   
  .emuWH{position:absolute;font-size:1px;width:1;height:1}   
  A{text-decoration:none;color:#FF66FF}   
  </style>   
    
    
    
    
    
  <SCRIPT   LANGUAGE="JavaScript">   
  <!--   
  function   drawCol(e){   
  var   div1   =   document.getElementById("canvas")   
  var   rows   =   e.parentNode.parentNode.rows;   
  var   cellIndex   =   e.cellIndex;   
  var   data   =   [];   
  for   (var   i=1;i<rows.length;i++){   
  var   d   =   parseInt(rows[i].cells[cellIndex].innerHTML);;   
  if   (isNaN(d)){   
  alert("Invalid   data!");   
  return;   
  }   
  var   color   =   rows[i].bgColor;   
  var   title   =   rows[i].cells[0].innerHTML;   
  data[i-1]   =   [d,color,title]   
  }   
  var   chartTitle   =   outText(250,150+(document.all?5:-10),e.innerHTML+"得分情况对比",15,"blue");   
  div1.innerHTML   =   chartTitle+drawPoleWidthData(data).join("")+drawPieWidthData(data).join("");   
  alert(div1.innerHTML);
  }   
  function   drawPieWidthData(data){   
  var   sum=0;   
  var   rs   =   new   Array();   
  for   (var   i=0;i<data.length;i++)   sum   +=   data[i][0];   
  var   startAngle   =   0;   
  for   (var   i=0;i<data.length;i++){   
  var   angle   =   data[i][0]/sum*360;   
  rs[i]   =   drawPie(580,250,100,startAngle,startAngle+=angle,data[i][1])   
  }   
  return   rs;   
  }   
  function   drawPoleWidthData(data){   
  var   rs   =   new   Array();   
  var   max   =   0;   
  for   (var   i=0;i<data.length;i++)   if(max<data[i][0])max=data[i][0];   
  for   (var   i=0;i<data.length;i++){   
  rs[rs.length]   =   outText(i*100+140,400+(document.all?5:-10),data[i][2],12,"blue");   
  var   top   =   400-200*data[i][0]/max;   
  rs[rs.length]   =   drawRectangle(i*100+130,top,i*100+170,400,data[i][1],"￥"+fixTo(data[i][0]))   
  }   
  rs[rs.length]=   drawLine(100,400,500,400,"black")   
  rs[rs.length]=   drawLine(100,400,100,150,"black")   
  rs[rs.length]=   drawLine(500,400,490,405,"black")   
  rs[rs.length]=   drawLine(100,150,95,160,"black")   
  rs[rs.length]=   drawLine(500,400,490,395,"black")   
  rs[rs.length]=   drawLine(100,150,105,160,"black")   
  return   rs;   
  }   
  function   drawRow(e){   
  var   div1   =   document.getElementById("canvas")   
  var   row   =   e.parentNode;   
  var   cells   =   row.cells;   
  var   rowIndex   =   row.rowIndex;   
  var   data   =   [];   
  for   (var   i=1;i<cells.length;i++){   
  var   d   =   parseInt(cells[i].innerHTML);;   
  if   (isNaN(d)){   
  alert("Invalid   data!");   
  return;   
  }   
  var   color   =   row.bgColor;   
  var   title   =   row.parentNode.rows[0].cells[i].innerHTML;   
  data[i-1]   =   [d,color,title]   
  }   
  var   chartTitle   =   outText(250,150+(document.all?5:-10),e.innerHTML+"得分情况走向",15,"blue");   
  div1.innerHTML   =   chartTitle+drawLineWidthData(data).join("");   
  alert(div1.innerHTML);
  }   
  function   drawLineWidthData(data){   
  var   rs   =   new   Array();   
  rs[rs.length]=   drawLine(100,400,770,400,"black")   
  rs[rs.length]=   drawLine(100,400,100,150,"black")   
  rs[rs.length]=   drawLine(770,400,760,405,"black")   
  rs[rs.length]=   drawLine(100,150,95,160,"black")   
  rs[rs.length]=   drawLine(770,400,760,395,"black")   
  rs[rs.length]=   drawLine(100,150,105,160,"black")   
  var   max   =   0;   
  for   (var   i=0;i<data.length;i++)   if(max<data[i][0])max=data[i][0];   
  var   top;   
  for   (var   i=0;i<data.length;i++){   
  rs[rs.length]   =   outText(i*100+140,400+(document.all?5:-10),data[i][2],12,"blue");   
  if   (i>0){   
  rs[rs.length]   =   drawLine(i*100+50,top,i*100+150,(400-200*data[i][0]/max),data[i][1])   
  }   
  top   =   400-200*data[i][0]/max;   
  }   
  return   rs;   
  }   
  //-->   
  </SCRIPT>   
  </HEAD>   
    
    
  <BODY>   
  <TABLE   bgcolor=black   cellspacing=1>   
  <TR   bgcolor=#FFFFCC>   
  <TD>得分</TD>   
  <TD   onclick="drawCol(this)"   align=center><A   HREF="javascript:;">第1场</A></TD>   
  <TD   onclick="drawCol(this)"   align=center><A   HREF="javascript:;">第2场</A></TD>   
  <TD   onclick="drawCol(this)"   align=center><A   HREF="javascript:;">第3场</A></TD>   
  <TD   onclick="drawCol(this)"   align=center><A   HREF="javascript:;">第4场</A></TD>   
  <TD   onclick="drawCol(this)"   align=center><A   HREF="javascript:;">第5场</A></TD>   
  <TD   onclick="drawCol(this)"   align=center><A   HREF="javascript:;">第6场</A></TD>   
  <TD   onclick="drawCol(this)"   align=center><A   HREF="javascript:;">第7场</A></TD>   
  </TR>   
  <TR   bgcolor=#CCFFCC>   
  <TD   onclick="drawRow(this)"><A   HREF="javascript:;">二分球</A></TD>   
  <TD>14</TD>   
  <TD>24</TD>   
  <TD>8</TD>   
  <TD>32</TD>   
  <TD>12</TD>   
  <TD>18</TD>   
  <TD>22</TD>   
  </TR>   
  <TR   bgcolor=#CCCCFF>   
  <TD   onclick="drawRow(this)"><A   HREF="javascript:;">三分球</A></TD>   
  <TD>9</TD>   
  <TD>3</TD>   
  <TD>15</TD>   
  <TD>6</TD>   
  <TD>3</TD>   
  <TD>9</TD>   
  <TD>3</TD>   
  </TR>   
  <TR   bgcolor=#FFCCCC>   
  <TD   onclick="drawRow(this)"><A   HREF="javascript:;">罚球</A></TD>   
  <TD>8</TD>   
  <TD>7</TD>   
  <TD>2</TD>   
  <TD>11</TD>   
  <TD>3</TD>   
  <TD>5</TD>   
  <TD>12</TD>   
  </TR>   
  </TABLE>   
  <div   id=canvas></div>   
  </BODY>   
  </HTML>]]></DhtmlChart><fixedPosition author="WC" date="" common=""><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>浮动</title>
<style type="text/css">
#postBar {
	position:fixed;
	left:0px;
	bottom:0;
	_position:absolute;
	_top:expression(document.documentElement.clientHeight + document.documentElement.scrollTop - this.offsetHeight);
}
</style>
</head>
<body>postBar
<div style="height:1000px;"></div>
<div id="postBar"><img src="http://static.kijiji.cn/images/post.gif" alt="广告" /></div>
</body>
</html>]]></fixedPosition><fixedPosition author="Joe Du" date="" common=""><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="utf-8" />
<title>position:fixed</title>
<meta name="Author" content="Doyoe(飘零雾雨), dooyoe@gmail.com" />
<style type="text/css">
html,body{margin:0;padding:0;text-align:center;}
html{_overflow:hidden;}
body{height:100%;overflow:auto;}
.fixed{position:fixed;_position:absolute;left:0;top:0;padding:10px;background:#000;color:#fff;}
.main{width:700px;margin:0 auto;}
</style>
</head>
<body>
<div class="main">
<p>Begin</p>
<p>很帅滴测试</p>

<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>

<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>

<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>

<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>很帅滴测试</p>
<p>End</p>
</div>

<div class="fixed">我始终在屏幕左上角哦</div>
</body>
</html>]]></fixedPosition><findText author="" date="" common=""><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.adKeyword {
 color: #FF0000;
}
-->
</style>
</head>
<body>
<p>　　一个和尚挑水吃、两个和尚抬水吃、三个和尚没水吃。总寺的方丈大人得知情况后，就派来了一名主持和一名书记，共同负责解决这一问题。主持上任后，发现问题的关键是管理不到位，于是就招聘一些和尚成立了寺庙管理部来制定分工流程。为了更好地借鉴国外的先进经验，寺庙选派唐僧等领导干部出国学习取经；此外，他们还专门花钱请了天主教、基督教的神父传授MBA。神父呆了不久留下几个东东就走了，一个叫BPR，一个叫ERP。</p>
<p> </p>
<p>　　书记也没闲着，他认为问题的关键在于人才没有充分利用、寺庙文化没有建设好，于是就成立了人力资源部和寺庙工会等等，并认认真真地走起了竞聘上岗和定岗定编的过场。</p>
<p> </p>
<p>　　几天后成效出来了，三个和尚开始拼命地挑水了，可问题是怎么挑也不够喝。不仅如此，小和尚都忙着挑水、寺庙里没人念经了，日子一长，来烧香的客人越来越少，香火钱也变得拮据起来。为了解决收入问题，寺庙管理部、人力资源部等连续召开了几天的会，最后决定，成立专门的挑水部负责后勤和专门的烧香部负责市场前台。同时，为了更好地开展工作，寺庙提拔了十几名和尚分别担任副主持、主持助理，并在每个部门任命了部门小主持、副小主持、小主持助理。</p>
<p> </p>
<p>　　老问题终于得到缓解了，可新的问题跟着又来了。前台负责念经的和尚总抱怨口渴水不够喝，后台挑水的和尚也抱怨人手不足、水的需求量太大而且没个准儿，不好伺候。</p>
<p> </p>
<p>　　为了更好地解决这一矛盾，经开会研究决定，成立一个新的部门：喝水响应部，专门负责协调前后台矛盾。为了便于沟通、协调，每个部门都设立了对口的联系和尚。   协调虽然有了，但效果却不理想，仔细一研究，原来是由于水的需求量不准、水井数量不足等原因造成的。于是各部门又召开了几次会，决定加强前台念经和尚对饮用水的预测和念经和尚对挑水和尚满意度测评等，让前后台签署协定、相互打分，健全考核机制。为了便于打分考核，寺院特意购买了几个计算机系统，包括挑水统计系统、烧香统计系统、普通香客捐款分析系统、大香客捐款分析系统、挨上必死系统（简称IBS系统）、马上就死系统（简称MS系统）等，同时成立香火钱管理部、香火钱出账部、打井策略研究部、打井建设部、打井维护部等等。由于各个系统出来的数总不准确、都不一致，于是又成立了技术开发中心，负责各个系统的维护、二次开发。由于部门太多、办公场地不足，寺院专门成立了综合部来解决这一问题，最后决定把寺院整个变成办公区，香客烧香只许在山门外烧。 </p>
<p> </p>
<p>　　部门多、当官的多档和开会自然就多，为了减少文山会海，综合办牵头召开了N次关于减少开会的会，并下达了“关于减少档的档”。同时，为了精简机构、提高效率，寺院还成立了精简机构办公室、机构改革研究部等部门。 </p>
<p> </p>
<p>　　一切似乎都合情合理，但香火钱和喝水的问题还是迟迟不能解决。问题在哪呢？有的和尚提出来每月应该开一次分析会，于是经营分析部就应运而生了。分析需要很多数据和报表，可系统总是做不到，于是每个部门都指派了一些和尚手工统计、填写报表、给系统打工。</p>
<p> </p>
<p>　　寺院空前地热闹起来，有的和尚在拼命挑水、有的和尚在拼命念经、有的和尚在拼命协调、有的和尚在拼命分析……忙来忙去，水还是不够喝、香火钱还是不够用。什么原因呢？这个和尚说流程不顺、那个和尚说任务分解不合理，这个和尚说部门界面不清、那个和尚说考核力度不够。只有三个人最清楚问题之关键所在，那三个人就是最早的那三个和尚。说来说去，就是***闲人太多了！他们说：“整天瞎分析个屁！什么***流程问题、职责问题、接口问题、考核问题，明明就是机构臃肿问题！早知今日，还不如当初咱们仨自觉自律一点算了！如今倒好，招来了这么一大帮傻B，一个个不干正经事还***人五人六的，跟屎盆子一样甩都甩不掉！”</p>
<p> </p>
<p>　　又过了一年，寺院黄了，和尚们也都死了。人们在水井边发现了几具尸体，是累死的；在寺院里发现了几千具尸体，是渴死的。</p>
</body>
</html>
<script language="JavaScript" type="text/javascript"><!--

if(document.createRange){
 var range = document.createRange();
}else
 var range = document.body.createTextRange(); 

if(range.findText){
 while(range.findText("和尚")){
  range.pasteHTML(range.text.fontcolor("#4499ee"));
  range.collapse(true);
 }
}else{ 
 var s,n;
 s = window.getSelection();
 while(window.find("和尚")){
  
  var n = document.createElement("SPAN");
  n.style.color="#ff0000" 

  s.getRangeAt(0).surroundContents(n);
 }
}

//--></script>]]></findText>
	<checkPasswordRank author="WC" date="" common="校验密码级别"><![CDATA[<script type="text/javascript">
var checkPassWord = function (string) {
//校验密码级别
    return string.replace(/^(?:(?=.{4})(?=.*([a-z])|.)(?=.*([A-Z])|.)(?=.*(\d)|.)(?=.*(\W)|.).*|.*)$/, "$1$2$3$4").length;

};

alert(checkPassWord("你好 wc"));
</script>]]></checkPasswordRank><combobox author="dh20156" date="" common="简单可输入选择框原型"><![CDATA[<style type="text/css">
.combobx {width:100px;overflow:hidden;position:relative;background:red;}
.combobxB {width:100px;position:absolute;left:0;top:1px;clip:rect(1px auto auto 81px);}
/*FF下调整一点点.combobxB {width:100px;position:absolute;left:0;top:0;clip:rect(2px auto auto 81px);}*/
.combobxA {width:100px;}
</style>

<div class="combobx">
<input type="text" class="combobxA">
<select class="combobxB">
<option>小学</option>
<option>中学</option>
<option>大学</option>
</select>
</div>]]></combobox><inherit author="月影" date="" common="月MM的继承"><![CDATA[<script>
Function.prototype.createInstance = function()
{
	var p = this.getPrototype();
	this.apply(p,arguments);
	return p;
}
Function.prototype.getPrototype = function()
{
	var p = function(){};
	p.prototype = this.prototype;
	return new p;
}
_getPrototypeType = function(obj)
{
	var p = function(){};
	p.prototype = obj;
	return p;
}
Function.prototype.Extends = function()
{
	var $args = Array.prototype.slice.apply(arguments);
	var parent = $args[$args.length-1] || function(){};
	parent = parent instanceof Function ? parent : _getPrototypeType(parent);
	var $p = this;
	var ret = function(){
		parent.apply(this, arguments);
		$p.apply(this, arguments);
	}
	ret.prototype = parent.getPrototype(); //原型继承
	var $par = parent;
	ret.Extends = function(parent)
	{
		return Function.prototype.Extends.call(this, $par.Extends(parent));
	}
	if($args.length > 1)
	{
		ret = ret.Extends.apply(ret,$args.slice(-1));	
	}
	return ret;
}

/*属性继承*/

function A(x,y)
{
	this.x = x;
	this.y = y;
}
var B = function(x,y,z)
{
	this.x = 5;
	this.z = z;
}.Extends(A);

var b = new B(10,20,30);
alert("属性继承："+[b.x,b.y,b.z]);


var C = function(x,y,z,w)
{
	this.w = w;
}.Extends(B);
C.prototype.toString = function(){
	return [this.x,this.y,this.z,this.w].toString();
}

var c = new C(10,20,30,40);
c.x=60;
var d = new C(1,2,3,4);
alert(c);
alert(d);


/*高级属性继承（多继承）*/
function MA(x)
{
	this.x = x;
	return this;
}
function MB(x,y)
{
	this.y = y;
	return this;
};

var MC = function(x,y,z)
{	
	this.x = 100;	//改写了x
	this.z = z;
	return this;
}.Extends(MA,MB);

var mc = new MC(1,2,3);
alert("多重继承："+[mc.x,mc.y,mc.z]);
//alert(mc instanceof MA);

/*方法继承*/
function FA(){
	return this;
}
FA.prototype.a = function(){
	alert("FA");
}
function FB(){
	return this;
}
FB.prototype.b = function(){
	alert("FB");
}
var FC = function(){
	return this;
}.Extends(FA);

FC.prototype.a = function(){
	alert("a in FC");
}
FC.prototype.c = function(){
	alert("FC");
}
alert("方法继承：");
var fc = new FC();
fc.a();

/*JSON继承*/
var JType = function(){
	this.x = 100;
}.Extends({a:1,b:2,c:3});
JType.prototype.toString = function()
{
	return [this.x, this.a, this.b, this.c];
}
var j = new JType();
alert("JSON继承："+j.toString());

alert("继承一个很多属性的JSON对象，与普通extend的效率比较：");
extend=function(c,p){for(var i in p)c[i]=p[i];return c};

/*继承一个很多属性的JSON对象，与普通的extend比较*/
var bigArr = {};
for(var i = 0; i < 150; i++) bigArr[i] = i;

var d = new Date();
for(var i = 0; i < 1000; i++)
{
	var JType = function(){
		this.x = 100;
	}.Extends(bigArr);
}
alert("这种继承方式："+(new Date() - d));

var d = new Date();
for(var i = 0; i < 1000; i++)
{
	var JType = function(){
		this.x = 100;
	}
	extend(JType,bigArr);
}
alert("普通的extend："+(new Date() - d));
</script>]]></inherit><charset author="WC" date="" common="VBSJS转进制"><![CDATA[<script language="vbscript">
document.write HEX(ASCW("啊"))
document.write "&#x" & HEX(ASCW("啊")) & ";"
</script>
<hr />
<script type="text/javascript">
document.write("啊".charCodeAt(0).toString(16));
document.write('&#x', "啊".charCodeAt(0).toString(16), ';');
</script>]]></charset><arguments author="dron,wc" date="" common="arguments数组操作"><![CDATA[<script>
(function () {
	var arr=Array.prototype.shift.call(arguments,0);
	alert("removed:"+arr+"\nSurplus length:"+arguments.length);
})(1,2,3)
</script>]]></arguments><cssCircularBead author="飘零雾雨" date="" common="css圆角"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>css圆角效果</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<style type="text/css">
div.RoundedCorner{background: #9BD1FA}
div.RoundedCorner p {margin:0 6px;}
b.rtop, b.rbottom{display:block;background: #FFF}
b.rtop b, b.rbottom b{display:block;height: 1px;overflow: hidden; background: #8AC0E9}
b.r1{margin: 0 5px}
b.r2{margin: 0 3px}
b.r3{margin: 0 2px}
b.rtop b.r4, b.rbottom b.r4{margin: 0 1px;height: 2px}
</style>
</head>
<body>
<div class="RoundedCorner">
<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
<p>无图片实现圆角矩形</p>
<p>无图片实现圆角矩形</p>
<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>
</div>
</body>
</html>]]></cssCircularBead><cssCircularBead author="飘零雾雨" date="" common="css圆角"><![CDATA[<!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd">

<style type="text/css">
h1 {margin:0;}
.a {width:250px;background:red;padding:1px 0;margin:0 1px;}
.b {position:relative;zoom:1;background:red;margin:0 -1px;}

.c {background:red;padding:1px 0;margin:0 1px;}
.d {background:red;margin:0 -1px;}
</style>

<div class="a">
  <div class="b">
        <h1>1px圆角框</h1>
  </div>
</div>
<hr/>
<div class="c">
  <div class="d">
        <h1>1px圆角框</h1>
  </div>
</div>]]></cssCircularBead><combobox author="dh20156" date="" common="简单可输入选择框原型"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
<title>可选择可输入的下拉框</title>
<style type="text/css">
.combobx {width:100px;overflow:hidden;position:relative;padding:0;display:inline;}
.combobx input {width:80px;position:absolute;left:0;top:0;}
.combobx select {width:100px;position:absolute;left:0;top:0;clip:rect(auto auto auto 82px);}
</style>
</head>
<body>
<form method="post" action="#">
学历:
<div class="combobx"><input type="text" name="xxx">
<select onchange="this.parentNode.childNodes[0].value=this.value;">
<option value="小学">小学</option>
<option value="中学">中学</option>
<option value="大学">大学</option>
</select>
</div>
</form>
</body>
</html>]]></combobox><combobox author="飘零雾雨" date="" common="简单可输入选择框原型"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
<title>可选择可输入的下拉框</title>
<meta name="Author" content="Doyoe(飘零雾雨), edzmaster@gmail.com" />
<style type="text/css">
form,p {
	margin:0;
	padding:0;
}
form {
	position:relative;
}
.dys {
	position:absolute;
	z-index:4;
	left:110px;
	width:22px;
	overflow:hidden;
}
.dys select {
	margin-left:-110px;
	width:132px;
	_width:129px;
}
.dyw {
	position:absolute;
	z-index:5;
	#top:-1px;
}
.dyw input {
	width:110px;
	border-right:none;
	border-bottom:1px solid #ddd;
}
</style>
</head>
<body>
<form method="post" action="#">
<p class="dys">
	<select name="oks" id="oks" onchange="document.getElementById('okw').value=this.value;">
		<option value="可输入的下拉框">可输入的下拉框</option>
		<option value="输入文字试试">输入文字试试</option>
		<option value="下拉选择试试">下拉选择试试</option>
	</select>
</p>
<p class="dyw">
	<input type="text" name="okw" id="okw" value="可输入的下拉框" />
</p>
</form>
</body>
</html>]]></combobox><copyToClipboard author="meixx" date="2008-03-13" common="for:IE,FF,OP"><![CDATA[<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script src="http://free.qq.com/js080103/jslib.js"></script>
<script language="JavaScript">
<!--

function copyToClipboard(txt,cbf){
	if(window.clipboardData && window.clipboardData.setData){
		if(!window.clipboardData.setData("Text",txt))
			alert("复制文本内容失败!"); return false;
	}else if(Browser.isOpera && navigator.mimeTypes["application/x-shockwave-flash"]){
		var d = document.createElement("div");
		document.getElementsByTagName("body")[0].appendChild(d);
		d.innerHTML="<embed src='clipboard.swf' FlashVars='clipboard="+escape(txt)+"' width='0' height='0' type='application/x-shockwave-flash'></embed>";
	}else if(window.netscape){
		try{
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
		}catch(e){
			if(confirm('您的firefox安全限制限制您进行剪贴板操作!\n您可以在地址栏中输入"about:config"将"signed.applets.codebase_principal_support"设置为"true"来开启此功能!\n\n您需要现在就开启此功能吗？'))
				window.location.href="about:config";
			return false;
		}
		try{
			clip=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard)
			trans=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable)
		}catch(e){return false;}
		trans.addDataFlavor("text/unicode");
		var oStr=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
		oStr.data=txt;
		trans.setTransferData("text/unicode",oStr,txt.length*2);
		try{clipid=Components.interfaces.nsIClipboard}catch(e){return false;}
		clip.setData(trans,null,clipid.kGlobalClipboard)
	}else{
		alert("该功能只支持MSIE，firefox和opera浏览器！");
		return false;
	}
	if(cbf instanceof Function) cbf();
}
function copy(){
	copyToClipboard($("txtTest").value)
}
//-->
</script>
</head>

<body>
<input type="text" id="txtTest" size="50"><input type="button" onclick="copy()" value="复制">
</body>
</html>
]]></copyToClipboard><motion author="M2" date="" common="斜线运动"><![CDATA[<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv=content-type content="text/html; charset=UTF-8">
<STYLE>
v\:* { Behavior: url(#default#VML) }
</STYLE>
<title> new document </title>
<style type="text/css">
body{margin:0px;padding:0px;}
div{position:absolute;width:200px;height:200px;padding-top:0px;border:1px solid red;color:blue}
</style>
<script language="JavaScript">
<!--
var startX = 20,startY=20;
var endX=800,endY=200;
var time = 20;
var steps = 100;

function moveDiv(div){
	div.style.left=startX+"px";
	div.style.top=startY+"px";
	var dx = endX - startX;
	var dy = endY - startY;
	var curStep = 0;  
	//var newline=document.createElement('<v:line from="'+startX+','+startY+'" to="'+endX+','+endY+'"></v:line>');
	//newline.style.border="2px solid blue";
	//document.getElementsByTagName("body")[0].appendChild(newline);
	function md(){
		curStep++;
		if(curStep>steps){ clearInterval(timer); return ;}
		var sx = dx * curStep / steps;
		var sy = dy * curStep / steps;
		div.style.left = (startX + sx) + "px";
		div.style.top = (startY + sy) + "px";

	}
	var timer = setInterval(md,time);
}
//-->
</script>
</head>
<body>
<div id="divPadding">你太西藏了</div>
<script type="text/javascript">
<!--
moveDiv(document.getElementById("divPadding"));
//-->
</script>
</body>
</html>]]></motion><clearRepeat author="JK" date="" common="去掉字符串里重复的字符"><![CDATA[<script type="text/javascript">
<!--

var str= "qwuerpoiuaksjdfhkajsdhoiquweriuqwioefkasjshdfkahdiofuweioruoqiwer";
var reg = /(.)(?=.*\1)/ig;
alert(str.replace(reg,""));

//-->
</script>]]></clearRepeat><clearRepeat author="WC" date="" common="去掉数组中重复的元素"><![CDATA[<script type="text/javascript">
<!--

var str= [1,1,2,3,3,4,5,6,7,8,9,9,10,20,21,37,156,20156];
var reg = /\b(\d+),(?=.*?\b\1\b)/g;
alert(str.join(",").replace(reg,""));

//-->
</script>]]></clearRepeat><resetChildNodes author="dh20156" date="" common="清除节点间的空白节点"><![CDATA[<div id="test" style="border:1px solid buttonface;">
	<p>p1 test</p> <p>test 2</p>
	<p>p2	test</p>
</div>

<script type="text/javascript">
function resetChildNodes(_elm){
	var _cn = _elm.childNodes,_nd = null;
	for(var i=0;i<_cn.length;i++){
		_nd = _cn[i];
		if(_nd.nodeType==3&&!(_nd.nodeValue.replace(/\s/g,''))){
			_elm.removeChild(_nd);
		}
	}
}
var obj = document.getElementById("test");

resetChildNodes(obj);
document.write('<p>test childNodes[iIndex]:<br/>');
document.write(obj.childNodes[0].innerHTML+'<br/>');
document.write(obj.childNodes[1].innerHTML+'<br/>');
document.write(obj.childNodes[2].innerHTML+'<br/>');
document.write('</p>');

document.write('<p>test firstChild & lastChild:<br/>');
document.write(obj.firstChild.innerHTML+'<br/>');
document.write(obj.lastChild.innerHTML+'<br/>');
document.write('</p>');
</script>]]></resetChildNodes><getPosition author="WC" date="" common=""><![CDATA[var rePos = function () {
	return document.documentElement.getBoundingClientRect && function (o) {
		var pos = o.getBoundingClientRect(), root = o.ownerDocument || o.document;
		return { x : pos.left + root.documentElement.scrollLeft, y : pos.top + root.documentElement.scrollTop };
	} || function (o) {
		var x = 0, y = 0;
		do { x += o.offsetLeft, y += o.offsetTop; } while (o = o.offsetParent);
		return { 'x' : x, 'y' : y };
	};
}();]]></getPosition><stopEvent author="dh20156" date="" common="阻止事件冒泡和返回值"><![CDATA[<html>
<head>
<style type="text/css">
div {border:1px solid buttonface;padding:10px;}
a {color:green;}
#t {color:red;}
</style>
</head>
<body>
<div onclick="alert('單擊了div');" oncontextmenu='alert("右擊了div");'>
    <a id="t" href="#">這個鏈接的左鍵和右鍵觸發的事件結果都被阻止</a>
    <a href="#">這個鏈接沒有做任何限制</a>
</div>
<script type="text/javascript">
var stopEvent = function(e){
    e = e||window.event;

    //阻止冒泡
    if(e.stopPropagation){
        e.stopPropagation();
    }else{
        e.cancelBubble = true;
    }

    //阻止Event返回值
    if(e.preventDefault){
        e.preventDefault();
    }else{
        e.returnValue = false;
    }
}

var a = document.getElementById("t");

if(document.attachEvent){
    a.attachEvent('onclick',stopEvent);
    a.attachEvent('oncontextmenu',stopEvent);
}else{
    a.addEventListener('click',stopEvent,false);
    a.addEventListener('contextmenu',stopEvent,false);
}
</script>
</body>
</html>]]></stopEvent><OO author="dh20156" date="" common="简单面向对象示例"><![CDATA[<script type="text/javascript">
//类 - 动物
var animal = function(){
    //生命
    this.live = true
    //性别
    this.gender = "male";
}
//动物的行为方式
animal.prototype = {
    //进食
    dine:function(){
        alert('进食');
    },
    //移动
    move:function(){
        alert('移动');
    },
    //繁殖
    breed:function(){
        alert('雌雄交配进行繁殖');
    }
}

//类 - 人
var person = function(){
    //继承动物的属性
    animal.call(this);
    //人还有人自己的一些属性
    this.name = "Adam";
    this.complexion = "white";
}
//继承动物的行为方法
person.prototype = new animal();
//改写人的行为方法
person.prototype.dine = function(){
    (this.live)?alert("肤色："+this.complexion+" ，性别："+this.gender+" ，姓名："+this.name+'\n用嘴吃东西！杂食！'):alert('不能进食！\nthis guy was dead!');
}
person.prototype.move = function(){
    alert("肤色："+this.complexion+" ，性别："+this.gender+" ，姓名："+this.name+'\n用两条腿直立行走！\n随着社会的进步，'+this.name+'可以乘坐不同的交通工具来代替行走！');
}

//实例
var pCharlie = new person();
pCharlie.name = "charlie";
pCharlie.complexion = "yellow";
pCharlie.dine();
pCharlie.move();
pCharlie.breed();
pCharlie.live = false;
pCharlie.dine();
</script>]]></OO><constructorAndPrototype author="dh20156" date="" common="构造与原型"><![CDATA[<script type="text/javascript">
var person = function(_name){
    this.name = _name;
}
person.prototype = {
    children:[],
    showName:function(){
        alert(this.name);
    },
    showChildren:function(){
        alert(this.children);
    }
}

var pCharlie = new person('charle');
var pJoy = new person('joy');

/*name属性是构造函数里定义的，它都指向具体的实例，所以，无论哪个实例更改name值，其他实例都不会受到影*/
pCharlie.showName();
pJoy.showName();

pCharlie.name = "charlie_du";

pCharlie.showName();
pJoy.showName();
/*pJoy的name始终是joy*/

/*每个实例同时都成为它的instanceof对象的prototype的引用
   因为是引用，我们知道，它可以更改原始对象下的具有属性的属性。
   即，原始对象中，属性值是一个对象的，这个对象可以被引用更改，
   从而影响到原始对象的内容
*/
pCharlie.showChildren();
pJoy.showChildren();

pCharlie.children.push("kirui");

pCharlie.showChildren();
pJoy.showChildren();
/*children属性是一个Array，它是一个对象，所以它被实例pCharlie更改后，
   影响到了pCharlie指向的person.prototype.children，而我们知道，
   每个实例都是它的instanceof对象的prototype的引用，大家用的都是同一份内容，
   所以，pJoy的showChildren()出来的也是"kirui"
*/
</script>]]></constructorAndPrototype><getMax author="WC" date="" common=""><![CDATA[<script type="text/javascript">
var newArray = function(n){
    var arr = [];
    for(var i=0;i<n;i++) arr[i] = Math.random();
    return arr;
}

var aF = newArray(100000);

var getMax = function (a, n) {
    var i = 10, l = a.length, t = a.splice(0, 10).sort(function (a, b) { return b - a; }), j;
    //遍历大数组
    for (; i < l ; i ++) {
        //比较插入最大10个数
        for (j = 0 ; j < n ; j ++) {
            if (t[j] < a[i]) {
                t.splice(j, 0, a[i]);
                break;
            }
        }
    }
    //截断超过10位以外的元素
    t.length = n;
    return t;
};

var t = new Date;
alert(getMax(aF, 10).join("\n")+"\n\nTime used:"+(new Date()-t));
</script>]]></getMax><defineClassInObject author="WC" date="" common="在对象中定义类"><![CDATA[<script>
var a = {
     b:function () {
	 	var tf = function(txt){
			this.txt = txt;
		};
		tf.prototype = {
			show:function(){
				alert(this.txt);
			}
		};
	 	return tf;
	 }()
}

var B = new a.b('test');
B.show();
</script>]]></defineClassInObject><PrototypeShare author="dh20156" date="" common="实例与prototype共享"><![CDATA[<script type="text/javascript">
var a = function(){this.C="c"}
a.prototype = {
     A:1,
     B:"a",
     D:[1],
     E:function(){alert('a');},
     F:{f:function(){alert('a')}}
}

alert(
'构造函数a及a的原型：\n'+
'a.prototype.A,'+typeof a.prototype.A+','+a.prototype.A+'\n'+
'a.prototype.B,'+typeof a.prototype.B+','+a.prototype.B+'\n'+
'a.prototype.C,'+typeof a.prototype.C+','+a.prototype.C+'\n'+
'a.prototype.D,'+typeof a.prototype.D+','+a.prototype.D+'\n'+
'a.prototype.E,'+typeof a.prototype.E+','+a.prototype.E+'\n'+
'a.prototype.F,'+typeof a.prototype.F+','+a.prototype.F.f
);

var b = new a();

alert(
'a的实例b：\n'+
'b.A,'+typeof b.A+','+b.A+'\n'+
'b.B,'+typeof b.B+','+b.B+'\n'+
'b.C,'+typeof b.C+','+b.C+'\n'+
'b.D,'+typeof b.D+','+b.D+'\n'+
'b.E,'+typeof b.E+','+b.E+'\n'+
'b.F,'+typeof b.F+','+b.F.f
);

//更改實例b的值，只能更改到a的原型中屬性為object的值的內容


b.A = 2;
b.B = "b";
b.C = "c";
b.D[0] = 2;
b.E = function(){alert('b')};
b.F.f = function(){alert('b')};

alert(
'更改实例b的值：\n'+
'b.A,'+typeof b.A+','+b.A+'\n'+
'b.B,'+typeof b.B+','+b.B+'\n'+
'b.C,'+typeof b.C+','+b.C+'\n'+
'b.D,'+typeof b.D+','+b.D+'\n'+
'b.E,'+typeof b.E+','+b.E+'\n'+
'b.F,'+typeof b.F+','+b.F.f
);

alert(
'a的原型中，属性为object的值的内容被更改：\n'+
'a.prototype.A,'+typeof a.prototype.A+','+a.prototype.A+'\n'+
'a.prototype.B,'+typeof a.prototype.B+','+a.prototype.B+'\n'+
'a.prototype.C,'+typeof a.prototype.C+','+a.prototype.C+'\n'+
'a.prototype.D,'+typeof a.prototype.D+','+a.prototype.D+'\n'+
'a.prototype.E,'+typeof a.prototype.E+','+a.prototype.E+'\n'+
'a.prototype.F,'+typeof a.prototype.F+','+a.prototype.F.f
);

</script>]]></PrototypeShare><PrototypeShare author="dh20156" date="" common=""><![CDATA[<script type="text/javascript">

var Clone = function(object){    
    var f = function(){};
    var r = function(fo,o,sfo){
        for(i in o){
            document.write(sfo+'['+i+'] = '+o[i]+'<br/>');
            fo[i] = {};
            if(o[i].constructor==Object){
                arguments.callee(fo[i],o[i],sfo+'['+i+']');
                continue;
            }
            fo[i] = o[i];
        }
    };
    r(f.prototype,object,'f.prototype');
    return new f();
};

var Person={
    info:{name:"feiwen",sex:"男"},
    site:"WEB前端开发"
}    
var demo = Clone(Person);    
demo.info.name="demo";    
demo.info.sex="女";    
demo.site="和我一样是http://www.jslab.org.cn";    

//--------问题出在这里------------//    
document.write('demo.info.name = '+demo.info.name+'<br/>');//输出：demo    
document.write('Person.info.name = '+Person.info.name+'<br/>');//输出：demo，问题在这里基类Person的子类info的值被覆盖了！    

var matou=Clone(Person);
document.write('matou.info.name = '+matou.info.name);//输出：demo    
</script>]]></PrototypeShare><constructorAndPrototype author="dh20156" date="" common=""><![CDATA[<script type="text/javascript">

/*原型的继承方式原本是很好的，不过因为存在实例共享冲突，所以我们需要采用与类抄写结合的方式来实现*/

var a = function(){
    this.children = [];
}
a.prototype = {
    get:function(){
        alert(this.children);
    },
    set:function(a){
        this.children.push(a);
    }
}

var A = function(){}
A.prototype = new a();

var iA = new A();
var iB = new A();

alert(iA.children === iB.children);

iA.set('iA');
iA.get();
iB.get();

</script>]]></constructorAndPrototype><ScopeChainAndClosure author="dh20156" date="" common=""><![CDATA[<script type="text/javascript">

/*
   作用域链(Scope Chain)
   JavaScript中的一种重要机制，JS中所有的标识符（Identifier）都是通过Scope Chain来查找值的。
*/

var i = "w i";

/*
   词法作用域(Lexical Scoping)
   JavaScript中的函数运行在它们被定义的作用域里,而不是它们被执行的作用域里.

   这个作用域我们称之为[[scope]]
   非内嵌函数的[[scope]]都是宿主对象，不同的宿主会有不同的内容
*/
var a =function(){
    alert(i);
}

var b = function(){
    var i = "b i";
    a();
}

var c = function(){
    a();
}

a();
/*
   函数在运行的时候，会先创建一个call Object，
   将函数的形参、变量和函数申明的结果都添加到call Object作为属性；
   把call Object添加到该函数的作用域链的最前面；
   然后，再将函数定义时的[[scope]]添加到它的作用域链中；

   函数体内的标识符查找
   先从Scope Chain中第一个对象找，存在则返回，否则
   继续查找下一个对象，存在则返回，否则（重复此步骤）
   最后找不到则返回undefined
*/


b();
c();

/*
   JavaScript中的scope Chain的机制使得闭包得以实现
*/
var d = function(){
    var i = "d i";
    var e = function(){
        alert(i);
    }
    return e;
}

var f = d();
f();
/*
   f是function e的引用
   call Object部分：没有形参、变量申明和内部函数；
   [[scope]]部分：e定义在函数d体内，e的[[scope]]中可以访问到d,i,e，然后d也会有一个[[scope]]，又可以接着往上访问，这样，便形成一条链
*/

</script>]]></ScopeChainAndClosure><ScopeChainAndClosure author="dh20156" date="" common=""><![CDATA[<script type="text/javascript">

/*
   具名函数表达式与匿名函数表达式和函数申明的区别
   winter:
   正常的函数定义时是直接把[[scope]]设为定义时的scope chain
   但是具名函数表达式是先给scope chain加入一个new Object
   之后再将[[scope]]设为新的scope chain
   设完后再将[[scope]]还原到正常函数定义时的[[scope]]
   等于是在正常函数定义时的[[scope]]添加了一个new Object到最前面

   在不同浏览器中对具名函数表达式的处理方式都太一样，都没太按ECMAScript中的规定去实现
   ECMAScript中关于具名函数表达式实现的规定大致如下：
   1、创建一个new Object
   2、将这个new Object插入到scope chain
   3、创建一个new Function，将scope chain设为[[scope]]
   4、为new Object添加一个属性，function name:function body（readOnly、don't Delete）
   5、移除new Object
   6、返回Function
*/

var test="wrong"

Object.prototype.test="right";

var f = function(){
    alert(test);
}
f();
/*
   正常函数申明运行时的作用域链
   call Object
   [[scope]]
*/


var f1 = function f0(){
    alert(test);
}
f1();
/*
   具名函数表达式运行时的作用域链
   call Object
   new Object
   [[scope]]
*/

</script>]]></ScopeChainAndClosure><ScopeChainAndClosure author="" date="" common=""><![CDATA[<button id="button_1">1</button>
<button id="button_2">2</button>
<button id="button_3">3</button>
<script type="text/javascript">

var i = 100;

/*eval使用当前函数的闭包*/

function x(){
    var i = 0;
    eval('i = "hello x"');
}

x();
alert(i);//100

/*eval使用全局闭包*/

function y(){
    var i = 0;
    try{
        window.execScript('i = "hello y"');
    }catch(e){
        window.eval('i = "hello y"');
    }
}

y();
alert(i);//hello y,except Safari

/*
   eval不能直接得到一个直接量的对象
   因為eval将{}当成了复合语句标识
*/

alert(eval('{name:"MyName"}'));//MyName

/*
   复合语句是用逗号运算符将几个语句联合起来，用花括号括起来，形成一个语句块(statement block)。
   复合语句允许使用标签，但只允许出现一个，并且出现在整段语句的最开始位置
*/

name:{"MyName",alert('2'),alert('3')}

/*
   我们要做的是改变花括号{}在eval中的意义，使它成为一个表达式或值
*/

//通过表达式运算符()，将{name:"MyName"}返回为一个值；
alert(eval('({name:"MyName"})'));

//我们也构造了一个复合语句，使得{name:"MyName"}成为这个复合语句里的一个表达式；
alert(eval('{0,{name:"MyName"}}'));

//可以进一步简化为连续表达式；
alert(eval('0,{name:"MyName"}'));


/*with与闭包的等同性 月MM*/

function abc() {
    var aArr = new Array('button_1', 'button_2', 'button_3');
    for (var i=0; i<3; i++) {
        with({i:i}){
            document.getElementById(aArr[i]).onclick= function(){
                alert('当前你点击的是button_'+(i+1));
            }
        }
    }
}
abc();

</script>]]></ScopeChainAndClosure><ScopeChainAndClosure author="Aimingoo" date="" common="优先级"><![CDATA[<script type="text/javascript">

/*
   當形參與未賦值的局部變量重名，取形參；
   當形參與有值局部變量重名，取局部變量；
   當局部函數與未賦值變量重名，取局部函數；
   當局部函數與有值局部變量重名，取局部變量；
   當形參名為arguments，將覆蓋arguments對象；
*/

function x(x,arguments){
    var x;
    alert(x+'\n'+typeof arguments);
}

x();                       //undefined,undefined
x('arguments',1);    //'arguments',number

function y(y,arguments){
    var y;
    function y(){}
    alert(y+'\n'+typeof arguments);
}

y();                       //function y(){},undefined;
y('arguments',1);    //function y(){},number;

function z(){
    var z = "z";
    function z(){}
    alert(z+'\n'+typeof arguments);
}

z();                       //'z',object;
z(1);                     //'z',object;

</script>]]></ScopeChainAndClosure><ScopeChainAndClosure author="dh20156" date="" common=""><![CDATA[<script type="text/javascript">

function add(){
    var args = Array.prototype.slice.call(arguments,0);
    var iNum = (args.length>0)?eval(args.join("+")):0;
    var innerAdd = function(){
        var args = Array.prototype.slice.call(arguments,0);
        iNum += (args.length>0)?eval(args.join("+")):0;
        return arguments.callee;
    }
    innerAdd.toString = function(){
        return iNum;
    }
    return innerAdd;
}

var x = add(1)(3)(5)(7)(9)(11)(13)(15)(17)(19);
alert(x);
x(20,30,40,50,60,70);
alert(x);
x = null;

</script>]]></ScopeChainAndClosure><prototypeChain author="dh20156" date="" common="原型链"><![CDATA[<script type="text/javascript">

/*
   每个对象实例都有个属性成员用于指向到它的instanceof 对象(暂称为父对象)的原型(prototype)
   我们把这种层层指向父原型的关系称为[原型链 prototype chian]
   原型也具有父原型，因为它往往也是一个对象实例，除非我们人为地去改变它

   在JavaScript中，"一切都是对象，函数是第一型。"
   Function和Object都是函数的实例。
   Function的父原型指向到Function的原型，Function.prototype的父原型是Object的原型
   Object的父原型也指向到Function的原型，Object.prototype是所有父原型的顶层

   在spiderMonkey引擎中，父原型可以通过 __proto__ 进行访问
*/

Function.prototype.hi = function(){alert('hi Function');}
Object.prototype.hi = function(){alert('hi Object');}

var a = function(){
    this.txt = "a";
}
a.prototype = {
    say:function(){alert('a');}
}

alert(a instanceof Function);//a是Function的实例;
alert(a.__proto__ === Function.prototype);//a的父原型指向到Function的原型;

alert(Function instanceof Object);//Function是Object的实例;
alert(Function.__proto__ === Function.prototype);//Function的父原型指向到Function的原型;
alert(Function.prototype.__proto__ === Object.prototype);//Function的原型的父原型指向到Object的原型

alert(Object.__proto__ === Function.prototype);//Object的父原型指向到Function的原型;
alert(Object.prototype.__proto__);//Object的原型是所有父原型的顶端，它不再具有父原型;


alert(a.prototype instanceof Object);//a的原型也是一个对象
alert(a.prototype.__proto__ === Object.prototype);//a的原型的父原型指向Object的原型



var A = function(){};
A.prototype = new a();
A.prototype.say = function(){
    alert('A');
}

alert(A instanceof Function);//A是Function的实例
alert(A.__proto__ === Function.prototype);//A的父原型指向到Function的原型
alert(A.prototype instanceof a);//A的原型是a的实例
alert(A.prototype.__proto__ === a.prototype);//A的原型的父原型指向到a的原型


var iA = new A();//iA是A的实例,iA.__proto__ === A.prototype
var iB = new a();//iB是a的实例,iB.__proto__ === a.prototype

iA.hi();
/*
iA本身没有hi方法（构造中没有，自己也没有定义过），
于是找iA.__proto__即A.prototype，也没有找到，
于是再找A.prototype.__proto__即a.prototype，仍然没有发现，
继续查找a.prototype.__proto__即Object.prototype，哇，发现了hi，于是调用它，停止查找
输出：hi Object
*/

iB.hi();
/*
iB本身没有hi方法（构造中没有，自己也没有定义过），
于是找iB.__proto__即a.prototype，仍然没有发现，
继续查找a.prototype.__proto__即Object.prototype，哇，发现了hi，于是调用它，停止查找
输出：hi Object
*/

a.hi();
/*
a本身没有hi方法（构造中没有，自己也没有定义过），
于是找a.__proto__既Function.prototype，哇，发现了hi，于是调用它，停止查找
输出：hi Function
*/

iA.say();
/*
iA本身没有say方法（构造中没有，自己也没有定义过），
于是找iA.__proto__即A.prototype，哇，发现了say，于是调用它，停止查找
所以，这里调用的是A.prototype.say
输出：A
*/

iB.say();
/*
iB本身没有say方法（构造中没有，自己也没有定义过），
于是找iB.__proto__即a.prototype，哇，发现了say，于是调用它，停止查找
所以，这里调用的是a.prototype.say
输出：a
*/

iA.bad();
/*
iA本身没有bad方法（构造中没有，自己也没有定义过），
于是找iA.__proto__即A.prototype，也没有找到，
于是再找A.prototype.__proto__即a.prototype，仍然没有发现，
继续查找a.prototype.__proto__即Object.prototype，终于是找不到了，停止查找
返回错误，iA.bad不是一个function
*/

</script>

感谢simon提出的修正意见！所有实例在查找属性方法时不会去查找自己的prototype(实例的prototype不在原型链内，只能作为一个属性)！

</script>]]></prototypeChain><prototypeChain author="dh20156" date="" common=""><![CDATA[<script type="text/javascript">

/*
   执行new操作后，函数构造中的变量、属性、方法将复制一份到一个新的对象并返回该对象
   函数的prototype不会被复制，而只是创建一份引用到新对象的__proto__属性中
   这也让我们知道了为什么构造中的内容要比原型中的内容优先级更高
*/

var a = function(){
    var x = "x";
    this.a = "a";
    this.say = function(){alert(this.a+','+x)}
}
a.prototype = {
    a:"ap",
    say:function(){alert('ap')}
}

var A = new a();
var B = new a();

document.write(typeof A);
document.write("<br/><br/>");

/*
   两个实例里的属性和方法都不是来自他们父对象里的属性方法的引用
*/
for(var i in A){
    document.write(i+':'+A[i]+'<br/>A.'+i);
    document.write((A[i]===a[i])?' === a.'+i+'<br/>A.'+i:' != a.'+i+'<br/>B.'+i);
    document.write((B[i]===a[i])?' === a.'+i+'<br/><br/>':' != a.'+i+'<br/><br/>');
}

document.write('__proto__<br/><br/>');
var O = A.__proto__;
for(var n in O){
    document.write(n+':'+O[n]+'<br/>');
}


A.say();
/*
   先找自己的属性方法，发现了say方法，于是调用它，停止查找，所以，不会找到父原型中的say方法；
   属性a和x的查找方法同上
   输出：a,x
*/

/*
   FF2下一個比較特殊的Object實例{}
   The production ObjectLiteral : {} is evaluated as follows:
   1. Create a new object as if by the expression new Object().
   2. Return Result(1). 

   我們發現，在FF2下，{}所指向的Object，即是Spec里定義的Object，又會是運行時的Object
   而其他瀏覽器下（包括FF3），{}都只能是Spec里定義的Object的實例
*/

Object.prototype.yy = 1;
Object = function () {
    this.xx = 2;
};

alert({}.xx+'\n'+{}.yy);

</script>]]></prototypeChain><prototypeChain author="dh20156" date="" common=""><![CDATA[<script type="text/javascript">

/*
   new操作原理（spiderMonkey引擎下）
*/

var a = function(sA,sH){
    var x = "x";
    this.a = sA;
    this.h = sH;
    this.say = function(){alert(this.a+','+x)}
}
a.prototype.hi = function(){alert(this.h)}

var createInstance = function(source){
    var p = {}
    var args = Array.prototype.slice.call(arguments,1);
    p.__proto__ = source.prototype;
    source.apply(p,args);
    return p;
}

var A = createInstance(a,"A","hi A");
A.say();
A.hi();

</script>]]></prototypeChain><JSON author="dh20156" date="" common="JSON格式转换"><![CDATA[<script type="text/javascript">

var JSON = function(sJSON){
    this.objType = (typeof sJSON);
    this.self = [];
    (function(s,o){for(var i in o){o.hasOwnProperty(i)&&(s[i]=o[i],s.self[i]=o[i])};})(this,(this.objType=='string')?eval('0,'+sJSON):sJSON);
}
JSON.prototype = {
    toString:function(){
        return this.getString();
    },
    valueOf:function(){
        return this.getString();
    },
    getString:function(){
        var sA = [];
        (function(o){
            var oo = null;
            sA.push('{');
            for(var i in o){
                if(o.hasOwnProperty(i) && i!='prototype'){
                    oo = o[i];
                    if(oo instanceof Array){
                        sA.push(i+':[');
                        for(var b in oo){
                            if(oo.hasOwnProperty(b) && b!='prototype'){
                                sA.push(oo[b]+',');
                                if(typeof oo[b]=='object') arguments.callee(oo[b]);
                            }
                        }
                        sA.push('],');
                        continue;
                    }else{
                        sA.push(i+':'+oo+',');
                    }
                    if(typeof oo=='object') arguments.callee(oo);
                }
            }
            sA.push('},');
        })(this.self);
        return sA.slice(0).join('').replace(/\[object object\],/ig,'').replace(/,\}/g,'}').replace(/,\]/g,']').slice(0,-1);
    },
    push:function(sName,sValue){
        this.self[sName] = sValue;
        this[sName] = sValue;
    }
}

var strA = '{allPrivList: [{id:"func001", desc:"商品管理"},{id:"func002", desc:"類別管理"},{id:"func003", desc:"行銷管理"}],groupList: [{id:"g001", desc:"客服", privList: ["func001", "func002", "func004"] },{id:"g002", desc:"營運", privList: ["func003"]}]}';
var objA = new JSON(strA);
alert(objA);
alert(objA.allPrivList[0].desc+'\n'+objA.groupList[0].privList+'\n'+objA.groupList[1].desc);
objA.push("C",[1,"hello baby",function(){alert(this.C[1])}]);
alert(objA);
objA.C[2].call(objA);



var objB = new JSON({});
alert(objB);
objB.push("A",function(){alert('test A')});
alert(objB);
objB.A();



var objC = new JSON([1]);
alert(objC);
objC.push("A",function(){alert('test A')});
alert(objC.A);



var xTree = new JSON({name:'root',list:[{name:'1',list:[{name:'1-1',list:[]},{name:'1-2',list:[]}]},{name:'look at me',list:[]}]});
alert(xTree);

var r = xTree.list.splice(1,1)[0];
alert(xTree);

xTree.list[0].list.splice(1,0,r);
alert(xTree);

</script>]]></JSON><noBreakWithAlert author="" date="" common="IE6 - Alert不会打断的脚本"><![CDATA[<script type="text/javascript">
function x(src){
 var img = new Image;
 var c = 1;
 img.onload = function(){test();}
 function test(){document.getElementById("Thread").innerHTML = ++c;}
 img.src = src;
}

x("http://bbs.51js.com/images/51js.gif");
</script>

<span id="Thread">0</span>
<input type=button value="alert" onclick="alert(window);">]]></noBreakWithAlert><noBreakWithAlert author="xingqiliudehuanghun" date="" common="FF - alert不会打断的脚本"><![CDATA[<script type="text/javascript">
function x(src){
 var img = new Image;
 var c = 1;
 img.onerror = function(){test();}
 function test(){document.getElementById("Thread").innerHTML = ++c;img.src=src;}
 img.src = src;
}

x(Math.random);
</script>

<span id="Thread">0</span>
<input type=button value="alert" onclick="alert(window);">]]></noBreakWithAlert><noBreakWithAlert author="" date="" common="Opera - alert不会打断的脚本"><![CDATA[<span id="t">0</span>
<button onclick="alert(window);">alert</button>

<script>
function x(){
var c = 1;
var oX = document.createElement("IFRAME");
oX.src = "about:blank";
oX.style.display = "none";
document.body.appendChild(oX);

function test(){
    document.getElementById('t').innerHTML = ++c;
    oX.contentWindow.setTimeout(test,1000);
}

return test;
}

x()();
</script>]]></noBreakWithAlert><noCircleOutput1to100 author="dh20156" date="" common="不用循环输出一至一百"><![CDATA[<script type="text/javascript">
var sAAA = new Array(100+1).join("a");
var sNum = sAAA.replace(/a/g,function(){return arguments[1]+1+"<br/>"});
document.write(sNum);
</script>]]></noCircleOutput1to100><noCircleOutput1to100 author="Joe Du" date="" common="不用循环输出一至一百"><![CDATA[<div><input type="button" onclick="test();" value="点击输出1-100" /></div>
<div id="t2"></div>

<script type="text/javascript">
var x = document.getElementById("t2");
var i = 1;
var t = null;
function test(){
	if(i<=100){
		x.innerHTML += i++;
		x.innerHTML += "<br />";
		t = setTimeout(test,1);
	}
}
</script> ]]></noCircleOutput1to100><googleInterviewing author="dh20156" date="" common=""><![CDATA[<script type="text/javascript">

/*
   输入a_1, a_2, ..., a_n, b_1, b_2, ..., b_n，如何在O(n)的时间，用O(1)的空间，
   将这个序列顺序改为a_1, b_1, ..., a_n, b_n。
*/

var n = ['a_1','a_2','a_3','a_4','a_5','b_1','b_2','b_3','b_4','b_5'];
var m = function(sN){
    var l = sN.length/2;
    var t = sN.splice(0,l);
    for(var i=0;i<l;i++){
        t.splice((i+(i+1)),0,sN[i]);
    }
    return t.slice(0);
}(n.slice(0));

alert(m);
</script>]]></googleInterviewing><windowWidthAndHeight author="zhuyi" date="" common="浏览器窗体宽高集合"><![CDATA[<body>
<script type="text/javascript">
//如果使用DTD申明，请注意document.documentElement与document.body的兼容处理 - dh20156
var s="";
s+="\r\n网页整体区域宽："+document.body.clientWidth;
s+="\r\n网页可见区域高："+document.documentElement.clientHeight;//window.innerWidth -firefox;
s+="\r\n网页可见区域宽："+document.body.offsetWidth+"(包括边线的宽)";
s+="\r\n网页可见区域高："+document.body.offsetHeight+"(包括边线的高)";
s+="\r\n网页正文全文宽："+document.body.scrollWidth;
s+="\r\n网页正文全文高："+document.body.scrollHeight;
s+="\r\n网页被卷去的高："+document.body.scrollTop;
s+="\r\n网页被卷去的左："+document.body.scrollLeft;
s+="\r\n网页正文部分上："+window.screenTop;
s+="\r\n网页正文部分左："+window.screenLeft;
s+="\r\n屏幕分辨率的高："+window.screen.height;
s+="\r\n屏幕分辨率的宽："+window.screen.width;
s+="\r\n屏幕可用工作区高度："+window.screen.availHeight;
s+="\r\n屏幕可用工作区宽度："+window.screen.availWidth;
alert(s);
</script>
</body>]]></windowWidthAndHeight><Cookie author="zhuyi" date="" common=""><![CDATA[<script type="text/javascript">
// utility function to retrieve an expiration data in proper format;
function getExpDate(days)
{
    var expDate = new Date();
    if(typeof(days) == "number")
    {
        expDate.setDate(expDate.getDate() + parseInt(days));        
    }
    return expDate.toGMTString();
}

//utility function called by getCookie()
function getCookieVal(offset)
{
    var endstr = document.cookie.indexOf(";", offset);
    if(endstr == -1)
    {
        endstr = document.cookie.length;
    }
    return unescape(document.cookie.substring(offset, endstr));
}

// primary function to retrieve cookie by name
function getCookie(name)
{
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while(i < clen)
    {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
        {
            return getCookieVal(j);
        }
        i = document.cookie.indexOf(" ", i) + 1;
        if(i == 0) break;
    }
    return null;
}

// store cookie value with optional details as needed
function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie = name + "=" + escape(value) +
    "; expires=" + ((expires) ? expires : getExpDate(30)) +
    "; path=" + ((path) ? path : "/") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

// remove the cookie by setting ancient expiration date
function deleteCookie(name,path,domain)
{
    if(getCookie(name))
    {
        document.cookie = name + "=" +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}
</script>]]></Cookie><mouseCoords author="zhuyi" date="" common=""><![CDATA[<html>
<head>
<script type="text/javascript">
/*鼠标位置*/
function mouseCoords(ev)
{
    var ev = ev || window.event;
    // - document.body.clientLeft// - document.body.clientTop
    if(window.event)
    {
        return {
            x: event.clientX + document.documentElement.scrollLeft,
		    y: event.clientY + document.documentElement.scrollTop
        };
    }
    else
    {
        return {
			x: ev.pageX,
			y: ev.pageY
		};
    }
}
document.onmousemove = function(ev){
	var ev = ev || window.event;
	var pos = mouseCoords(ev);
	document.getElementsByTagName("DIV")[0].innerHTML = "X: "+ pos.x +"<br />Y: "+ pos.y;
};
</script>
</head>
<body>
<div style="position:absolute; left:45%; top:45%"></div>
</body>
</html>]]></mouseCoords><underLineColor author="飘零雾雨" date="" common="链接下划线颜色"><![CDATA[<style>
a {color:#000;text-decoration:underline;}
a em {color:#f60;text-decoration:underline;}
</style>

<a href="?">08款<em>一汽奔腾</em>最高让2万元</a>]]></underLineColor><binaryTree author="dh20156" date="" common="二叉树"><![CDATA[<script type="text/javascript">
var t = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19];

var deepView = function(aTree,iNode){
    (iNode in aTree) && (document.write(aTree[iNode]+'<br/>'),arguments.callee(aTree,2*iNode+1),arguments.callee(aTree,2*iNode+2))
}

var wideView = function(aTree,iNode){
    var aRTree = aTree.slice(0),iRNode = iNode,iLevel = 1;
    (iRNode in aRTree) && document.write(aRTree[iRNode]+'<br/>');
    (function(){
        var iStart = iRNode*2+1,iEnd = iStart+Math.pow(2,iLevel);
        document.write(aRTree.slice(iStart,iEnd).join(',')+'<br/>');
        if(iEnd>=aRTree.length) return;
        iRNode = iStart,iLevel++,arguments.callee();
    })()
}

document.write('<h3>二叉树 深度优先</h3>');
//深度优先
deepView(t,0);

document.write('<h3>二叉树 广度优先</h3>');
//广度优先
wideView(t,0);
</script>]]></binaryTree><contains author="" date="" common=""><![CDATA[<div id="a">a
    <div id="b">b
        <div id="c">c</div>
    </div>
</div>

<div id="d">d</div>

<script type="text/javascript">
var a = document.getElementById("a");
var c = document.getElementById("c");
var d = document.getElementById("d");

var contains = function(f,c){
    if(f==null) return false;
    var bCB2F = false;
    if(f.contains){
        bCB2F = f.contains(c);
    }else{
        bCB2F = (f.compareDocumentPosition(c)==20)?true:false;
    }
    return bCB2F
}

alert(contains(a,c));
alert(contains(a,d));

</script>]]></contains><static author="BL" date="" common="静态变量"><![CDATA[<script type="text/javascript">

var a = function(){
    this.txt = 'a';
}
a.prototype = (function(){
    var name = 'ap';
    return {
        showTxt:function(){
            alert(this.txt);
        },
        showName:function(){
            alert(name);
        }
    }
})()

var A = new a();
A.showTxt();
A.showName();
</script>]]></static><permutation author="dh20156" date="" common="全排列阶乘"><![CDATA[<script type="text/javascript">

var list = [0,1,2,3];

var lt = list.length;

var t = function(lt){
    var n=1,l=lt;
    while(l>0) n *= l--;
    return n;
}(lt);

alert(t);

</script>]]></permutation><permutation author="dh20156" date="" common="全排列,寻找P(i-1),P,P(i+1)"><![CDATA[<script type="text/javascript">

var list = ['a','b',1,2,3];

function getList(aList){
    aList.sort(function(a,b){var x=(isNaN(a))?-a.charCodeAt(0):a,y=(isNaN(b))?-b.charCodeAt(0):b;return x-y});//排序
    var aRlist=[],rv=[];//返回值
    (function(list){
        var tmpList=null,l=list.length;
        aRlist[list.join('')] = list;//存储当前排列
        for(var i=(l-2);i>-1;i--){//遍历要排列的数值
            var lx=list[i],x=(isNaN(lx))?-lx.charCodeAt(0):lx;//尝试寻找第一个P(i)，P(i)<P(i+1)
            var ly=list[i+1],y=(isNaN(ly))?-ly.charCodeAt(0):ly;
            if(x<y){//找到P(i)
                var idx = i+1;//尝试在P(i)右侧寻找大于P(i)的最小值，P(idx)，如果没找到，则P(i+1)则为匹配的最小值
                for(var n=idx;n<l;n++){
                    y=(isNaN(list[n]))?-list[n].charCodeAt(0):list[n];
                    var minX = x;
                    (x<y && y<minX)&&(minX=y,idx=n)
                }
                ly = list[idx];//取出该最小值P(idx)
                var aTmp = list.slice(0);
                aTmp[i] = ly,aTmp[idx] = lx,sTmp = aTmp.join('');//P(i)与P(idx)交换
                (!aRlist[sTmp])&&(aRlist[sTmp] = aTmp,arguments.callee(aTmp.slice(0)));//存储当前排列，进行下一次排列
            }
        }
    })(aList.slice(0))
    for(var o in aRlist) (aRlist.hasOwnProperty(o))&&rv.push(aRlist[o])//将已存储排列取出并返回
    return rv.slice(0);
}

var all = getList(list.slice(0));
alert(all.length);
document.write(all.join("<br/>"));

</script>]]></permutation><permutation author="dh20156" date="" common="全排列,由左到右逐一调换位置"><![CDATA[<script type="text/javascript">
var list = ['a','b',1,2,3];

var getList = function(aList){
    var aStation = [];aStation.push(aList.slice(0));
    var aReturn = [];aReturn.push(aList.slice(0));
    var oStation = [];oStation[aList.join('')] = 1;
    var iN = 1,iL=aList.length,l=aList.length;
    while(iL>0) iN *= iL--;

    while(aStation.length>0){
        var aTemp = aStation.shift();
        for(var i=0;i<(l-1);i++){
                if(aReturn.length>=iN){
                    aStation.length = 0,aStation = null,oStation = null;
                    return aReturn.slice(0);
                }
                var sTemp = aTemp.splice(i,1),n=i+1;
                aTemp.splice(n,0,sTemp);
                var jTemp = aTemp.join('');
                if(!oStation[jTemp]){
                    aStation.push(aTemp.slice(0));
                    aReturn.push(aTemp.slice(0));
                    oStation[jTemp] = 1;
                }
        }
    }
    aStation.length = 0,aStation = null,oStation = null;
    return aReturn.slice(0);
}

var all = getList(list);
alert(all.length);
document.write(all.join('<br/>'));
</script>]]></permutation><permutation author="M2" date="" common="全排列,[a,b][b,a]"><![CDATA[<script type="text/javascript">

var list = ['a','b',1,2,3];

function getList(list){
	var l = list.length;
	switch(l){
		case 1:
			return list;break;
		case 2:
			var x = list[0].toString(),y=list[1].toString();
			return [x+y,y+x];break;
		default:var aR = "";
			for(var i=0,l=list.length;i<l;i++){
				var sF = list[i],arr=list.slice(0,i).concat(list.slice(i+1,l));
				aR += setList(sF,getList(arr)).join(",")+",";
			}
			return aR.replace(/\,$/,"").split(",");
			break;
	}
}

function setList(sF,aL){
	for(var i=0,l=aL.length;i<l;i++){
		aL[i] = sF.toString()+aL[i];
	}
	return aL;
}

document.write(getList(list).join('<br/>'));
</script>]]></permutation><permutation author="dh20156" date="" common="更新版"><![CDATA[<script type="text/javascript">

var list = [1,2,3,4,5,6];

function getList(list){
	var l = list.length;
	switch(l){
		case 1:
			return list;break;
		case 2:
			return [list[0]+''+list[1],list[1]+''+list[0]];break;
		default:var aR = [];
			for(var i=0,l=list.length;i<l;i++){
				var sF = list[i],arr=list.slice(0,i).concat(list.slice(i+1,l));
				aR.push(setList(sF,getList(arr)));
			}
			return aR;
			break;
	}
}

function setList(sF,aL){
	for(var i=0,l=aL.length;i<l;i++){
		aL[i] = sF+''+aL[i].toString().split(",").join(","+sF);
	}
	return aL;
}

document.write(getList(list).join('<br/>'));
</script>]]></permutation><customerEvents author="月MM" date="" common="自定义事件"><![CDATA[<script type="text/javascript">

Function.prototype.DECLEAR_EVENT = function(evt_type){
    var method = this;
    var type = evt_type;

    return function(){
        method.apply(this,arguments);
        for(each in this.EventListeners[type])
            this.EventListeners[type][each](this);
    }
}   

function  MyObject(){
    //保存事件监听函数数组
    this.EventListeners = new Array();
}

MyObject.prototype.Run = function(x){
    alert(x);
}.DECLEAR_EVENT("onrun");//onrun事件声明

MyObject.prototype.AddEvent = function(name,listener){
    this.EventListeners[name]?
    this.EventListeners[name].push(listener):this.EventListeners[name]=[listener];
}

function OnRun1(sender){
    alert("已经执行了OnRun1事件");
}

function OnRun2(sender){
  alert("已经执行了OnRun2事件");
}

var myobj = new MyObject();

//添加两个监听函数
myobj.AddEvent("onrun",OnRun1);
myobj.AddEvent("onrun",OnRun2);

//执行Run方法，如无例外，会触发onrun事件
myobj.Run('xxx');

</script>]]></customerEvents><cssText author="" date="" common=""><![CDATA[<html>
<head>
<body>
<script type="text/javascript">
var obj1 = document.createElement("div");
obj1.setAttribute("id","div1");
obj1.style.cssText = "left:100; top:100; width:200; height:200; position:absolute; background-color:#FF0000;";
obj1.innerHTML=" <h1>cssText</h1>";

var obj2 = document.createElement("div");
obj2.setAttribute("id","div2");
obj2.style.cssText = "left:200; top:200; width:200; height:200; position:absolute; background-color:#00FF00;";
obj2.innerHTML=" <h1>cssText</h1>";

document.body.appendChild(obj1);
document.body.appendChild(obj2);
</script>
</body>
</html>]]></cssText><defaultChecked author="Rank" date="" common="默认选中状态fixed IE form control bug"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd">
<html>
 <head>
 <title>Rank's HTML document</title>
 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
 <meta http-equiv="Pragma" content="no-cache" /> 
 <meta http-equiv="Cache-Control" content="no-cache" /> 
 <meta http-equiv="Expires" content="0" />
 <meta http-equiv="ImageToolbar" content="no" />
 <meta http-equiv="Creator.name" content="Rank, BlueDestiny, never-online" />
 <style type="text/css" title="default" media="screen">
      body { font-size:80%; line-height:1.5; }
      body, button { font-family:arial; }
      button { padding:0 0.3em 0 0.3em; }
      h1, h3 { margin:0; padding:0; }
      h1 { font-size:2.3em; }
      h3 { font-size:1.3em; }
      form { display:inline-block; }
      div.link { padding:1em; }
      div.content { background:#ffc; padding:1em; border:1px solid #222; margin:1em 0 1em; }
      #rdoWrapper { }
      #hd { text-align:center; }
 </style>
 </head>
 <body>
    <div id="hd">
      <h1> fixed IE form control bug </h1>
      <div class="link">from: <a href="http://www.never-online.net/blog"><em>never-online weblog</em></a></div>
    </div>
    <div id="rdoWrapper" class="content">
      <h3> 1. Select radio to checked </h3>
      <form method="post">
      <input type="radio" name="rdo" id="rdo-1" value="rdo-1" checked><label for="rdo-1">radio1</label>
      <input type="radio" name="rdo" id="rdo-2" value="rdo-2"><label for="rdo-2">radio2</label>
      <input type="radio" name="rdo" id="rdo-3" value="rdo-3"><label for="rdo-3">radio3</label>
      <input type="radio" name="rdo" id="rdo-4" value="rdo-4"><label for="rdo-4">radio4</label>
      </form>
    </div>
    <div class="content">
      <h3> 2. Click button to change dom structure </h3>
        <p class="p"><button type="button" onclick="handleChangeDom()">test</button></p>
    </div>
    <script type="text/javascript">
      function getRadioValue(ctlName) {
        var ctls = document.getElementsByName(ctlName);
        var len = ctls.length;
        for (var i=0; i<len; i++) {
          if (ctls[i].checked) {
            return ctls[i].value;
          }
        }
      }
      function setRadioDefaultValue(ctlName) {
        var ctls = document.getElementsByName(ctlName);
        var len = ctls.length;
        for (var i=0; i<len; i++) {
          ctls[i].defaultChecked = ctls[i].checked;
        }
      }
      function handleChangeDom() {
        alert('before append, you select radio value is "'+getRadioValue('rdo')+'"');
        setRadioDefaultValue('rdo');
        var wrapper = document.getElementById('rdoWrapper');
        document.body.appendChild(wrapper);
        alert('after append, you select radio value is "'+getRadioValue('rdo')+'"');
      }
    </script>
 </body>
</html>]]></defaultChecked><combination author="dh20156" date="" common="组合"><![CDATA[<script type="text/javascript">
var aList = [1,2,3,4,5,6,7,8,9,10,11,12];

function fooCombination(aList,n){
    if(1>=n){
        return aList;
    }else{
        var aRV = [];
        var fooSetCB = function(x,aList){
            while(aList.length>0){
                var y = aList.shift();
                var z = Array.prototype.concat.call(x,y);
                (z.length==n)?aRV.push(z):arguments.callee(z,aList.slice(0));
            }
        }
        while(aList.length>=n){
            var x = aList.shift();
            fooSetCB(x,aList.slice(0));
        }
        return aRV.slice(0);
    }
}

var n = 2;
var aGroup = fooCombination(aList.slice(0),n);
document.write('从'+aList+'中，选取'+n+'个的组合有：'+aGroup.length+'种：<br/>'+aGroup.join('<br/>'));
</script>]]></combination><combination author="winter" date="" common=""><![CDATA[<script type="text/javascript">
var aList = [1,2,3,4,5,6,7,8,9,10,11,12];

function C(arr,n){
	var set=[];
	var resault=[];
	for(var i=0;i<arr.length;i++){
		var l=set.length;
		for(var j=0;j<l;j++){
			var tmp=set[j].slice();
			tmp.push(arr[i]);
			if(tmp.length==n)resault.push(tmp);
			else set.push(tmp);
		}
		set.push([[arr[i]]]);
	}
	return resault;
}

var n = 2;
var aGroup = C(aList.slice(0),n);
document.write('从'+aList+'中，选取'+n+'个的组合有：'+aGroup.length+'种：<br/>'+aGroup.join('<br/>'));
</script>]]></combination><createEvent author="wc" date="" common=""><![CDATA[<div id="d" onclick="alert(1)">&nbsp;</div>
<script type="text/javascript">
window.onload = function () {
var d = document.getElementById('d');
	if (d.addEventListener) {
		d.addEventListener('click', function () {
			alert(2);
		}, false);
		var evt = document.createEvent('MouseEvents');
		evt.initEvent('click', true, true);
		d.dispatchEvent(evt);
	} else {
		d.attachEvent('onclick', function () {
			alert(3);
		});
		d.click();
	}
}
</script>]]></createEvent><drawBox author="dh20156" date="" common="回字的写法"><![CDATA[<script type="text/javascript">
/*
输出
1
-------
222
212
222
-------
33333
32223
32123
32223
33333
-------
4444444
4333334
4322234
4321234
4322234
4333334
4444444
------- 
........

*/

var list = [9,8,7,6,5,4,3,2,1];

var PrintBox = function(aList){
    var aList=aList.slice(0),aRV=[],sNow=null,iNow=0;
    while(aList.length>0){
        var iL = aList.length,sX = aList.shift(),sTemp = new Array(iL*2).join(sX);
        sNow = (iNow)?sNow.slice(0,iNow).concat(sTemp).concat(sNow.slice(iNow+(iL*2-1))):sTemp;
        aRV.push(sNow);
        iNow++;
    }
    return aRV.concat(aRV.slice(0).reverse().slice(1));
}

var aX = PrintBox(list);
document.write(aX.join('<br/>'));

</script>]]></drawBox><drawBox author="dh20156" date="" common=""><![CDATA[<script type="text/javascript">
/*
   aDir:[dir,steps,rules]
   dir:
   1 - left down, 2 - down, 3 - right down, 4 - left
   6 - right, 7 - left up, 8 - up, 9 - right up
   steps:0 - until out of the array
   rules:
*/

var box = function(iN,aDir,aPoint,iStart,iAdd){
    if(isNaN(iN)||iN<=1) return;
    this.iMP = Math.pow(iN,2);
    this.aDir = aDir||[[6,0],[2,0],[4,0],[8,0]];
    this.x = aPoint[0]||0;
    this.y = aPoint[1]||0;
    this.number = iStart||1;
    this.addn = iAdd||1;
    this.iDir = 0;
    this.iDL = this.aDir.length-1;
    this.times = 0;
    this.aTemp = [];
    this.aRV = new Array(iN);
    for(var i=0;i<iN;i++){
        this.aRV[i] = new Array(iN);
        for(var ii=0;ii<iN;ii++){
            this.aRV[i][ii] = 0;
        }
    }
}
box.prototype = {
    getXY:function(dir,x,y){
        switch(dir){
            case 1:return [x+1,y-1];break;
            case 2:return [x+1,y];break;
            case 3:return [x+1,y+1];break;
            case 4:return [x,y-1];break;
            case 6:return [x,y+1];break;
            case 7:return [x-1,y-1];break;
            case 8:return [x-1,y];break;
            case 9:return [x-1,y+1];break;
            default:return [x,y];
        }
    },
    getStep:function(step,rule,x,y){
        if(!step){
            return Infinity;
        }else{
            if(rule){
                return eval('('+step+rule+')');
            }else{
                return step;
            }
        }
    },
    move:function(){
        var times = this.times,aTemp = this.aTemp.slice(0);
        if(this.iDir>this.iDL) this.iDir = 0;
        var dirSteps = this.aDir[this.iDir],nowDir = dirSteps[0];
        var x=this.x,y = this.y,aXY = this.getXY(nowDir,x,y),flag = 0,rv = this.aRV.slice(0);
        var x1 = aXY[0],y1 = aXY[1],ti = x1+''+y1,steps = this.getStep(dirSteps[1],dirSteps[2],x1,y1);
        if(times==steps) flag = 1;
        if(x1!=x && (typeof rv[x1]=='undefined'||rv[x1][y1]>0)) flag = 1;
        if(y1!=y && (typeof rv[x1]=='undefined'||typeof rv[x1][y1]=='undefined'||rv[x1][y1]>0)) flag = 1;
        if(times>steps) flag = 2;
        if(aTemp[ti]&&aTemp[ti]>1) flag = 2;
        switch(flag){
            case 0:this.times += 1;this.x=x1;this.y=y1;this.number += this.addn;
                      this.aRV[this.x][this.y]=this.number;this.move();break;
            case 1:this.times = 0;this.iDir += 1;
                      if(typeof aTemp[ti]=='undefined'){this.aTemp[ti] = 1;}else{this.aTemp[ti] += 1;}
                      this.move();break;
            default:return;
        }
    },
    getBox:function(){
        this.aRV[this.x][this.y] = this.number;
        this.move();
        var iNL = this.number.toString().length;
        if(iNL>1){
            var reg = new RegExp('\\b\\d{1,'+(iNL-1)+'}\\b','g');
            return this.aRV.slice(0).join(';').replace(reg,function(){
                var x=iNL-arguments[0].length;return new Array(x+1).join('0')+''+arguments[0]
            }).split(';');
        }else{
            return this.aRV.slice(0);
        }
    }
}

document.write('<p>box 1 --------------------</p>');
var x1 = new box(8,[[6,0],[2,0],[4,0],[8,0]],[0,0],1,1);
document.write(x1.getBox().join('<br/>'));

document.write('<p>box 2 --------------------</p>');
var x2 = new box(8,[[6,1],[1,0],[2,1],[9,0]],[0,0],1,1);
document.write(x2.getBox().join('<br/>'));

document.write('<p>box 5 --------------------</p>');
var x5 = new box(8,[[6,1],[8,1,'*y'],[4,0],[8,1],[6,1,'*(7-x)'],[2,0]],[7,0],1,1);
document.write(x5.getBox().join('<br/>'));

document.write('<p>box 6 --------------------</p>');
var x6 = new box(8,[[6,0],[2,1],[4,0],[2,1]],[0,0],1,1);
document.write(x6.getBox().join('<br/>'));
</script>]]></drawBox><JavascriptPerformanceTest author="" date="" common=""><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<title>Javascript performance test</title>
	<style>
		body, span{font-family: verdana, sans serif; font-size: 12px;}
		input{margin-right: 20px;}
		span{padding-left: 20px;}
	</style>
	<script>
		var start;
		var end;
		var forLoopTime = 0;
		var addTime = 0;
		var subtractTime = 0;
		var multiplyTime = 0;
		var divideTime = 0;
		var divide2Time = 0;
		var fromArrayTime = 0;
		var parseIntTime = 0;
		var varTime = 0;
		var sinTime = 0;
		var floorTime = 0;
		var ifTime = 0;
		var readGlobalTime = 0;
		var concatStringsTime = 0;
		var sortArrayTime = 0;
		
		gValue = 123;
		
		var continueAfter = false;
	
		function testFor()
		{
			start = new Date();
			for (var i=0; i<=1000000; i++)
			{
				void(0);
			}
			end = new Date();
			forLoopTime = end-start;
			var textElem = document.createTextNode(forLoopTime + 'ms  ')
			document.getElementById('forResult').appendChild(textElem);
			completed();
		}
		
		function testAdd()
		{
				var value1=123;
				var value2=234;
				var value3;
				start = new Date();
				for (var i=0; i<=1000000; i++)
				{
					value3 = value1 + value2;
				}
				end = new Date();
				addTime = end-start;
				var textElem = document.createTextNode(addTime + 'ms  ')
				document.getElementById('addResult').appendChild(textElem);
				completed();
		}
		
		function testSubtract()
		{
				var value1=123;
				var value2=234;
				var value3;
				start = new Date();
				for (var i=0; i<=1000000; i++)
				{
					value3 = value2 - value1
				}
				end = new Date();
				subtractTime = end-start;
				var textElem = document.createTextNode(subtractTime + 'ms  ')
				document.getElementById('subtractResult').appendChild(textElem);
				completed();
		}
		
		function testMultiply()
		{	
				var value1=123;
				var value2=234;
				var value3;
				start = new Date();
				for (var i=0; i<=1000000; i++)
				{
					value3 = value2 * value1
				}
				end = new Date();
				multiplyTime = end-start;
				var textElem = document.createTextNode(multiplyTime + 'ms  ')
				document.getElementById('multiplyResult').appendChild(textElem);
				completed();
		}
		
		function testDivide()
		{
				var value1=123;
				var value2=234;
				var value3;
				start = new Date();
				for (var i=0; i<=1000000; i++)
				{
					value3 = value2 / value1
				}
				end = new Date();
				divideTime = end-start;
				var textElem = document.createTextNode(divideTime + 'ms  ')
				document.getElementById('divideResult').appendChild(textElem);
				completed();
		}
		
		function testDivide2()
		{
				var value1=123;
				var value2=234;
				var value3;
				start = new Date();
				var temp= (1 / value1);
				for (var i=0; i<=1000000; i++)
				{
					value3 = value2 * temp
				}
				end = new Date();
				divide2Time = end-start;
				var textElem = document.createTextNode(divide2Time + 'ms  ')
				document.getElementById('divide2Result').appendChild(textElem);
				completed();
		}
		
		
		
		function testFromArray()
		{
				var value3;
				var value4 = new Array(1,2,3,4,5,6,7,8,9,10)
				start = new Date();
				for (var i=0; i<=1000000; i++)
				{
					value3 = value4[6]
				}
				end = new Date();
				fromArrayTime = end-start;
				var textElem = document.createTextNode(fromArrayTime + 'ms  ')
				document.getElementById('fromArrayResult').appendChild(textElem);
				completed();
		}
		
		function testParseInt()
		{
				var value3;
				start = new Date();
				for (var i=0; i<=1000000; i++)
				{
					value3 = parseInt(123.23)
				}
				end = new Date();
				parseIntTime = end-start;
				var textElem = document.createTextNode(parseIntTime + 'ms  ')
				document.getElementById('parseIntResult').appendChild(textElem);
				completed();
		}
		
		function testVar()
		{
				start = new Date();
				for (var i=0; i<=1000000; i++)
				{
					var a=1; var b=2; var c=3;
				}
				end = new Date();
				varTime = end-start;
				var textElem = document.createTextNode(varTime + 'ms  ')
				document.getElementById('varResult').appendChild(textElem);
				completed();
			
		}
		
		function testSin()
		{
			var value3;
			start = new Date();
			for (var i=0; i<=1000000; i++)
			{
				value3 = Math.sin(.1)
			}
			end = new Date();
			sinTime = end-start;
			var textElem = document.createTextNode(sinTime + 'ms  ')
			document.getElementById('sinResult').appendChild(textElem);
			completed();			
		}
		
		function testFloor()
		{
			var value3;
			start = new Date();
			for (var i=0; i<=1000000; i++)
			{
				value3 = Math.floor(43.341)
			}
			end = new Date();
			floorTime = end-start;
			var textElem = document.createTextNode(floorTime + 'ms  ')
			document.getElementById('floorResult').appendChild(textElem);
			completed();			
		}
		
		function testIf()
		{
			var value1=123;
			start = new Date();
			for (var i=0; i<=1000000; i++)
			{
				if (value1<12)
				{
					void(0);
				}
			}
			end = new Date();
			ifTime = end-start;
			var textElem = document.createTextNode(ifTime + 'ms  ')
			document.getElementById('ifResult').appendChild(textElem);
			completed();			
		}
		
		function testReadGlobal()
		{
			var value
			start = new Date();
			for (var i=0; i<=1000000; i++)
			{
				value = gValue;
			}
			end = new Date();
			readGlobalTime = end-start;
			var textElem = document.createTextNode(readGlobalTime + 'ms  ')
			document.getElementById('readGlobalResult').appendChild(textElem);
			completed();			
		}
		
		function testConcatStrings()
		{
			var string1 = 'abcdefghijklmnopqrstuvxyz'
			var string2 = 'abcdefghijklmnopqrstuvxyz'
			var string3;
			start = new Date();
			for (var i=0; i<=1000000; i++)
			{
				string3 = string1 + string2;
			}
			end = new Date();
			concatStringsTime = end-start;
			var textElem = document.createTextNode(concatStringsTime + 'ms  ')
			document.getElementById('concatStringsResult').appendChild(textElem);
			completed();			
		}
		
		function testSortArray()
		{
			var theArray = new Array;
			for(i=0; i<=10000; i++)
				theArray[i] = parseInt(Math.random()*10000)
			start = new Date();
				theArray.sort();
			end = new Date();
			sortArrayTime = end-start;
			var textElem = document.createTextNode(sortArrayTime + 'ms  ')
			document.getElementById('sortArrayResult').appendChild(textElem);
			completed();			
		}
		
		
		function completed()
		{
			if(continueAfter)
			{
			if(forLoopTime==0)
				setTimeout('testFor()',10);
			else
				if(addTime==0)
					setTimeout('testAdd()',10);
				else
					if(subtractTime==0)
						setTimeout('testSubtract()',10);
					else
						if(multiplyTime==0)
							setTimeout('testMultiply()',10);
						else
							if(divideTime==0)
								setTimeout('testDivide()',10);
							else
								if(divide2Time==0)
									setTimeout('testDivide2()',10);
								else
									if(fromArrayTime==0)
										setTimeout('testFromArray()',10);
									else
										if(parseIntTime==0)
											setTimeout('testParseInt()',10);
										else
											if(varTime==0)
												setTimeout('testVar()',10);
											else
												if(sinTime==0)
													setTimeout('testSin()',10);
												else
													if(floorTime==0)
														setTimeout('testFloor()',10);
													else
														if(ifTime==0)
															setTimeout('testIf()',10);
														else
															if(readGlobalTime==0)
																setTimeout('testReadGlobal()',10);
															else
																if(concatStringsTime==0)
																	setTimeout('testConcatStrings()',10);
																else
																	if(sortArrayTime==0)
																		setTimeout('testSortArray()',10);
																	else	
																		continueAfter=false;
				}
			
			if(forLoopTime!=0&&addTime!=0&&subtractTime!=0&&multiplyTime!=0&&divideTime!=0&&divide2Time!=0&&fromArrayTime!=0&&parseIntTime!=0&&varTime!=0&&sinTime!=0&&floorTime!=0&&ifTime!=0&&readGlobalTime!=0&&concatStringsTime!=0&&sortArrayTime!=0)
			{			
				averageTime = (forLoopTime+addTime+subtractTime+multiplyTime+divideTime+divide2Time+fromArrayTime+parseIntTime+varTime+sinTime+floorTime+ifTime+readGlobalTime+concatStringsTime+sortArrayTime)/15;
				document.getElementById('averageResult').innerHTML = '<b>' + parseInt(averageTime) + 'ms</b>';
			}
		}
		
	</script>
</head>

<body>
<form>
<input type="button" value="for-loop" onclick="testFor()">1000000 times:<span id="forResult"></span><br>
<input type="button" value="add" onclick="testAdd()">1000000 times: <span id="addResult"></span><br>
<input type="button" value="subtract" onclick="testSubtract()">1000000 times:<span id="subtractResult"></span><br>
<input type="button" value="multiply" onclick="testMultiply()">1000000 times:<span id="multiplyResult"></span><br>
<input type="button" value="divide" onclick="testDivide()">1000000 times:<span id="divideResult"></span><br>
<input type="button" value="divide2" onclick="testDivide2()">1000000 times:<span id="divide2Result"></span><br>
<input type="button" value="get value from array" onclick="testFromArray()">1000000 times:<span id="fromArrayResult"></span><br>
<input type="button" value="parseInt()" onclick="testParseInt()">1000000 times:<span id="parseIntResult"></span><br>
<input type="button" value="var" onclick="testVar()">1000000 times:<span id="varResult"></span><br>
<input type="button" value="Math.sin()" onclick="testSin()">1000000 times:<span id="sinResult"></span><br>
<input type="button" value="Math.floor()" onclick="testFloor()">1000000 times:<span id="floorResult"></span><br>
<input type="button" value="if" onclick="testIf()">1000000 times:<span id="ifResult"></span><br>
<input type="button" value="read global variable" onclick="testReadGlobal()">1000000 times:<span id="readGlobalResult"></span><br>
<input type="button" value="concatenate strings" onclick="testConcatStrings()">1000000 times:<span id="concatStringsResult"></span><br>
<input type="button" value="sort Array" onclick="testSortArray()"><span id="sortArrayResult"></span><br>
<br>
<input type="button" value="Run all tests" onclick="continueAfter=true;completed()">Average time: <span id="averageResult"></span>
</form>
</body>
</html>]]></JavascriptPerformanceTest><exchangeHalfAndFull author="JK" date="" common="全角转半角"><![CDATA[<script language=javascript>
//全角空格为12288，半角空格为32
//其他字符半角(33-126)与全角(65281-65374)的对应关系是：均相差65248
//document.write((65281).toString(16)+"----"+(65374).toString(16)+"----"+(12288).toString(16));
String.prototype.dbc2sbc = function ()
{
return this.replace(/[\uff01-\uff5e]/g,function(a){return String.fromCharCode(a.charCodeAt(0)-65248);}).replace(/\u3000/g," ");
}
document.write("ＡＢＣ　１２３，我们都是好朋友".dbc2sbc());
</script>]]></exchangeHalfAndFull><easyTitle author="dh20156" date="" common=""><![CDATA[<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<title>自定义Title</title>
<script type="text/javascript">
var easyTitle = function(dModule){
    this.parent = dModule;
    this.init();
}

easyTitle.prototype = {
    getElementsByTitle:function(dModule){
        if(!dModule) return null;
        var dMC = dModule.childNodes,aDC = [],at = null;
        for(var i=0,l=dMC.length;i<l;i++){
            at = (dMC[i].getAttribute)?dMC[i].getAttribute("title"):null;
            if(!!at) aDC.push(dMC[i]);
        }
        return aDC.slice(0);
    },
    addEventListen:function(d,e,f,c){
        if(d&&f){
            if(document.attachEvent){
               for(var i=0,l=d.length;i<l;i++) d[i].attachEvent('on'+e,f);
            }else{
               for(var i=0,l=d.length;i<l;i++) d[i].addEventListener(e,f,c);
            }
        }
    },
    showTitle:function(e){
        var e = e||window.event,dObj = e.srcElement||e.target;
        var x = e.clientX,y = e.clientY;
        var sTitle = dObj.getAttribute('title'),sCss = dObj.getAttribute('titlestyle');
        var dTitle = document.getElementById('easyTitleShow');
        if(sTitle){
            dTitle.innerHTML = sTitle;
            sCss += ';position:absolute';
            sCss += ';left:'+(x-2)+'px';
            sCss += ';top:'+(y+19)+'px';
            sCss += ';display:;';
            dTitle.style.cssText = sCss;
        }
    },
    hideTitle:function(){
        var dTitle = document.getElementById('easyTitleShow');
        dTitle.style.display = 'none';
    },
    init:function(){
        var aTitle = this.getElementsByTitle(this.parent);
        if(aTitle){
            var dTitle = document.createElement('DIV');
            dTitle.style.display = 'none';
            dTitle.setAttribute('id','easyTitleShow');
            document.body.appendChild(dTitle);
            this.addEventListen(aTitle,'mouseover',this.showTitle,false);
            this.addEventListen(aTitle,'mousemove',this.showTitle,false);
            this.addEventListen(aTitle,'mouseout',this.hideTitle,false);
        }
    }
}

</script>
</head>
<body>

<img src='http://www.csdn.net/Images/logo_csdn.gif' title='CSDN床上等你' titlestyle='background:#eee;color:#000;border:1px solid #999;' />

<a href='http://www.csdn.net/' title='深入浅出CSDN' titlestyle='background:#000;color:#f00;border:1px solid #0f0;'>深入浅出CSDN</a>

<script type="text/javascript">
var et = new easyTitle(document.body);
</script>
</body>
</html>]]></easyTitle><easyValidate author="dh20156" date="" common=""><![CDATA[<html>
<head>
<title>easy Validate</title>
<script type="text/javascript">
var nameSpace = {
    checkForm:function(dForm){
        if(!dForm) return false;
            var rules = {
                isFilled:function(s){return function($value){return $value.replace(/\s/g,"").length>0&&$value!=s}},
                isNaN:function(){return function($value){return (!$value)?true:isNaN($value)}},
                isNumber:function(){return function($value){return (!$value)?true:!isNaN($value)}},
                isInt:function(){return function($value){return (!$value)?true:parseInt($value)==$value}},
                isEmail:function(){return function($value){return (!$value)?true:/^(?:\w\.?)*\w+@(?:\w\.?)+\w+$/i.test($value)}},
                isEmailList:function(){return function($value){return (!$value)?true:/^(?!;)(?:(?:;|^)([^@.;])+@[^.@;]+(?:\.[^.@;]+)+)+$/i.test($value)}},
                fileType:function(list){return function($value){var r = new RegExp('\.(?:'+list+')$','i');return (!$value)?true:r.test($value)}},
                moreThan:function(n){return function($value){return (!$value)?true:$value>n}},
                lessThan:function(n){return function($value){return (!$value)?true:$value<n}},
                equalTo:function(n){return function($value){return (!$value)?true:$value==n}},
                maxLength:function(n){return function($value){return (!$value)?true:!($value.length>n)}},
                minLength:function(n){return function($value){return (!$value)?true:!($value.length<n)}}
            }
            var chkInput = function(dObj){
                for(var i=0,l=dObj.length;i<l;i++){
                    var dT = dObj[i];
                    var vr = dT.getAttribute('validate');//validate property
                    var vm = dT.getAttribute('msg');//msg property
                    var $value = dT.value;//value
                    if(vr){
                        vr = vr.split(';'),vm = vm.split(';');
                        for(var n=0;n<vr.length;n++){
                            var avr = vr[n].match(/^(\w+)\(([^\)]*)\)$/i);//match the validate string look like 'fooName(xxx)'
                            var avrName = avr?avr[1]:vr[n];//fooName
                            var avrArgs = avr?avr[2]:null;//xxx
                            var msg = vm[n]?vm[n]:vm[vm.length-1];//alert message
                            var EVR = (rules[avrName])?rules[avrName](avrArgs)($value):false;
                            if(!EVR){
                                alert(msg);
                                dT.focus();
                                return false;
                            }
                        }
                    }
                }
            return true;
        }
        return chkInput(dForm.elements);
    }
}
</script>
</head>
<body>
    <form method="post" action="?">
        <p>
            <label for="name">* Name:</label>
            <input type="text" id="name" validate="isFilled;minLength(2);maxLength(8)" msg="Name must be filled!;min length of Name must be 2;max length of Name must be 8">
        </p>
        <p>
            <label for="sex">* sex:</label>
            <select id="sex" validate="isFilled(choose your sex)" msg="please choose your sex!"><option>choose your sex</option><option>male</option><option>female</option></select>
        </p>
        <p>
            <label for="age">* Age:</label>
            <input type="text" id="age" validate="isFilled;isNumber;isInt;moreThan(15)" msg="Age must be filled!;Age must be a number;Age must be a int number;Age must be more than 15">
        </p>
        <p>
            <label for="email">* Email:</label>
            <input type="text" id="email" validate="isFilled;isEmail" msg="Email must be filled!;Wrong email format!">
        </p>
        <p>
            <label for="photo">* Photo:</label>
            <input type="file" id="photo" validate="isFilled;fileType(jpg|gif|png)" msg="You need choose a photo!;Photo extend name must be in jpg,gif or png">
        </p>
        <p>
            <input type="submit">
            <input type="reset">
        </p>
    </form>
</body>
<script type="text/javascript">
var dForm = document.getElementsByTagName("FORM")[0];
if(dForm){
    dForm.onsubmit = function(){return nameSpace.checkForm(dForm)}
}
</script>
</html>]]></easyValidate><windowAndWindow author="" date="" common=""><![CDATA[window和Window是不同的。

在Mozilla家族的瀏覽器(Mozilla,Netscape,Firefox)下，它們的關系是：

<script type="text/javascript">
alert(window);
alert(Window);
alert(window==Window);
alert(window===Window);
alert(window.constructor===Window);
</script>

其他瀏覽器不支持 Window]]></windowAndWindow><selection author="kejun" date="" common=""><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Editor_雅虎</title>

<script type="text/javascript">
var inp;

var initEditor = function(){
	inp = document.getElementById('editframe');
	var inp2 = window.frames['editframe'];
	var inp3 = window.frames.editframe;
	if(inp.contentWindow.document.designMode){
		inp.contentWindow.document.designMode = "on";
	}
	window.setTimeout(function(){
	inp.contentWindow.document.body.style.fontSize = "12px";
	inp.contentWindow.document.body.style.margin = "0";
	inp.contentWindow.document.body.style.padding = ".5em";
	inp.contentWindow.document.body.id = "rich_txt_editor";
	inp.contentWindow.document.getElementsByTagName("html")[0].style.width = "100%";
	inp.contentWindow.document.getElementsByTagName("html")[0].style.height = "100%";
	inp.contentWindow.document.getElementsByTagName("html")[0].style.cursor = "text";
	inp.contentWindow.focus();
	},100);
};

window.onload=initEditor;

function insert(){
	var win = inp.contentWindow;
	var sel = (win.getSelection)? win.getSelection() : win.document.selection;
	if(sel.rangeCount == 0){return;}
	var range = (sel.getRangeAt)? sel.getRangeAt(0).cloneRange() : sel.createRange();
	if(range.startContainer){
		sel.removeAllRanges();
		range.deleteContents();
		var container = range.startContainer;
		var pos = range.startOffset;
		range = document.createRange();
		var cons = win.document.createTextNode("test");
		if(container.nodeType == 3){
			container.insertData(pos, cons.nodeValue);
			range.setEnd(container, pos + cons.nodeValue.length);
			range.setStart(container, pos + cons.nodeValue.length);
		}else{
			var afternode = container.childNodes[pos];
			container.insertBefore(cons, afternode);
			range.setEnd(cons, cons.nodeValue.length);
			range.setStart(cons, cons.nodeValue.length);
		}
		sel.addRange(range);
	}else{
		var cnode = range.parentElement();
		while(cnode.tagName.toLowerCase() != "body"){
			cnode = cnode.parentNode;
		}
		if(cnode.id && cnode.id=="rich_txt_editor"){
			range.pasteHTML(",:),");
		}
	}
	win.focus();
}
</script>

</head>
<body>

<iframe name="editframe" id="editframe" frameborder="1"></iframe>

<button type="button" onclick="insert();">Insert</button>

</body>
</html>]]></selection><HTMLmarkup author="" date="" common="HTML标签"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>HTML 测试文档</title><link href="default.css" rel="stylesheet" type="text/css" /></head><body>	<h1>HTML 测试文档 </h1>	<ul>		<li>版本: 1.1 </li>		<li>DTD: XHTML 1.0 transitional</li>		<li>编码: UTF-8</li>		<li>更新: 2008-6-12</li>	</ul>		<hr />		<h1>&lt;h1&gt; 代表一号标题 </h1>	<h2>&lt;h2&gt; 代表二号标题 </h2>	<h3>&lt;h3&gt; 代表三号标题 </h3>	<h4>&lt;h4&gt; 代表四号标题 </h4>	<h5>&lt;h5&gt; 代表五号标题 </h5>	<h6>&lt;h6&gt; 代表六号标题 </h6>		<p>这一段由&lt;p&gt;包含。&lt;p&gt;表示一个段落，是最常用的文本流格式。我们可以在文本流中使用各种内联文本标签。最常用的有这几种：		<strong> &lt;strong&gt;加重</strong>，		<em>&lt;em&gt; 强调</em>，		<ins>&lt;ins&gt; 插入</ins>，		<del>&lt;del&gt; 删除</del>，		<sub>&lt;sub&gt; 下标</sub>，		<sup>&lt;sup&gt; 上标</sup>，		<cite>&lt;cite&gt;  引用</cite>，<big>&lt;big&gt;增大</big>，<small>&lt;small&gt;缩小</small>。	</p>			<pre>			这是一段由&lt;pre&gt;包含的文本流。		在它其中的空格，制表符，回车等可以被直接在网页上，而且也不会被浏览器自动换行。可以用它显示程序代码。	预格式默认是用等宽字体。</pre>		<p>我们也可以用这些内联标签在文本流中显示代码段：		<code>&lt;code&gt;代码</code>，		<kbd>&lt;kbd&gt;键盘输入</kbd>， 		<var>&lt;var&gt;变量</var>， 		<samp>&lt;samp&gt;sample 例句</samp>。	</p>			<p>此外，有两个标签也很重要：</p>	<ul>		<li>&lt;abbr&gt;：比如<abbr title="Mister">Mr.</abbr>是Mister的缩写。但这个标记在IE中似乎无效。</li>		<li>&lt;acronym&gt;<acronym title=""></acronym>：比如<acronym title="Hyper Text Markup Language">HTML</acronym>是Hyper Text Markup Language的首字缩略语（中文也能用这个标签，如：“<acronym title="中华人民共和国">中国</acronym>”是“中华人民共和国”的简称）。</li>	</ul>		<blockquote cite="#">		这一段是&lt;blockquote&gt;。记得使用&lt;blockquote&gt;里的cite属性。	</blockquote>		<address>		这一段由&lt;address&gt;包含，可以用它来显示Email地址或者真实的地址。要注意的是它是块级元素，但默认没有margin或padding。	</address>	<div>这一段由&lt;div&gt;包含，&lt;div&gt;是块级元素，默认没有任何样式。和它地位相当的另一个元素是<span>&lt;span&gt;内联字段</span>，同样默认没有任何样式。<br />这句话的前面有一个&lt;br&gt;，用于段内换行。</div> <hr />		<p><a id="a"></a>这句话的前面有一个&lt;a&gt;标签实现的锚标记。</p>	<p><a href="http:///">&lt;a&gt;也表示链接</a>。注意它有四个伪类：:link是<a href="http:///">未访问链接</a>，:visited是<a href="#">已访问链接</a>，:hover是<a href="http:///">鼠标悬停时的链接</a>, :active<a href="http:///">鼠标点击激活时的链接</a>。</p>	<p><img width="100" height="100" alt="&lt;img&gt; 标签" /> 图片默认是inline的，但我们也可以将其定义为block。并专门为img定义一个.inline类<img width="100" height="30" alt="img.inline" class="inline" />。此外，链接中的&lt;img&gt;的样式又有所不同<a href="#"><img width="60" height="60" alt="&lt;a&gt;中的&lt;img&gt;" /></a>。</p>	<p><object width="200" height="150"><param name="movie" value=""></param></object>	还有用于插入媒体的&lt;object&gt;标签以及它里面的&lt;param&gt;标签。</p><hr />		<ul>		<li>无序列表的外层是&lt;ul&gt;</li>		<li>列表的每一项由&lt;li&gt;组成</li>		<li>注意，&lt;ul&gt;标签里只能直接包含&lt;li&gt;标签			<ul>				<li>这是嵌套的二级列表，必须放在某个&lt;li&gt;中</li>				<li>注意嵌套的二级列表项的样式可能与一级的不同					<ul>						<li>这是第三级，它的样式又和第二级的不同</li>					</ul>				</li>			</ul>		</li>	</ul>		<ol>		<li>有序列表的外层是&lt;ol&gt;</li>		<li>列表的每一项由&lt;li&gt;组成</li>		<li>注意，&lt;ol&gt;标签里只能直接包含&lt;li&gt;标签			<ol>				<li>这是嵌套的二级列表，必须放在某个&lt;li&gt;中</li>				<li>注意嵌套的二级列表项的样式可能与一级的不同					<ol>						<li>这是第三级，它的样式又和第二级的不同</li>					</ol>				</li>			</ol>		</li>	</ol>		<dl>		<dt>这一行是&lt;dt&gt;</dt>		<dd>这一行则是&lt;dd&gt;。而定义列表外层是&lt;dl&gt;。</dd>		<dt>注意&lt;dt&gt;只能包含内联级别元素</dt>		<dd>而&lt;dd&gt;可以包含内联或者块级的元素</dd>	</dl> 	<hr />			<p>标准表格模型。其中由&lt;colgroup&gt;与&lt;col&gt;控制列宽度。</p>	<table>		<caption>		此处是&lt;caption&gt;		</caption>		<colgroup>			<col width="30%" />			<col width="50%" />			<col width="20%" />		</colgroup>		<thead>			<tr>				<th>这一行是&lt;thead&gt;</th>				<th>&lt;thead&gt;中可以用&lt;th&gt;或&lt;td&gt;</th>				<th>这里使用的是&lt;th&gt;</th>			</tr>		</thead>		<tfoot>			<tr>				<td>最后一行是&lt;tfoot&gt;</td>				<td>&lt;tfoot&gt;无论放在什么位置，总显示在最末端</td>				<td></td>			</tr>		</tfoot>		<tbody>			<tr>				<td>以下三行是&lt;tbody&gt; </td>				<td>可以放任意个&lt;tr&gt;</td>				<td>这里使用的是&lt;td&gt;</td>			</tr>			<tr>				<td>用&lt;col&gt;表示列</td>				<td>该行最右单元为空表格单元，没有任何内容</td>				<td></td>			</tr>			<tr>				<td>用&lt;tr&gt;表示行</td>				<td>该行最右单元则有一个&amp;nbsp;</td>				<td>&nbsp;</td>			</tr>		</tbody>	</table>		<hr />		<form action="">		<p>&lt;form&gt;标签不可以直接包含各种控件标签，可以用<label>&lt;label&gt;</label>包含表单元件，</p>		<fieldset>			<legend>也可以用&lt;fieldset&gt;和&lt;legend&gt;标签将表单归组。</legend>			<p>对于input标签的CSS定义方法：将type属性的值也作为class名，这样就可以将不同的input控件区分开。</p>			<p>				<input type="text" class="text" size="20" id="text" value="textfield 单行文本框" />				<input type="text" class="text" size="20" id="text_d" value="禁用的textfield 单行文本框" disabled="disabled" />				<label for="text"> input.text </label>			</p>			<p>				<input type="password" class="text" size="20" id="password" value="password 密码框" />				<input type="password" class="text" size="20" id="password_d" value="禁用的password 密码框" disabled="disabled" />				<label for="password"> input.text </label>			</p>			<p>				<input type="submit" class="submit" id="submit" value="submit 提交按钮" />				<input type="submit" class="submit" id="submit_d" value="禁用的submit 提交按钮" disabled="disabled" />				<label for="submit"> input.submit </label>			</p>			<p>				<input type="reset" class="button" id="reset" value="reset 重置按钮" />				<input type="reset" class="button" id="reset_d" value="禁用的reset 重置按钮" disabled="disabled" />				<label for="reset"> input.button </label>			</p>			<p>				<input type="button" class="button" id="button" value="button 普通按钮" />				<input type="button" class="button" id="button_d" value="禁用的button 普通按钮" disabled="disabled" />				<label for="button"> input.button </label>			</p>			<p>				<input type="image" class="image" size="20" id="image" />				<label for="image"> input.image </label>			</p>			<p>				<input type="image" class="image" size="20" id="image_d" disabled="disabled" />				<label for="image_d"> 禁用的input.image</label>			</p>			<p>				<input name="radio" type="radio" class="radio" id="radio1" checked="checked" />				<input name="radio" type="radio" class="radio" id="radio2" />				<label>input.radio </label></p>			<p>				<input name="radio" type="radio" class="radio" id="radio1_d" checked="checked"  disabled="disabled" />				<input name="radio" type="radio" class="radio" id="radio2_d" disabled="disabled"  />				<label> 禁用的input.radio </label></p>			<p>				<input type="checkbox" class="checkbox" id="checkbox1" checked="checked" />				<input type="checkbox" class="checkbox" id="checkbox2" />				<label for="checkbox"> input.checkbox </label>			</p>			<p>				<input type="checkbox" class="checkbox" id="checkbox1_d" checked="checked" disabled="disabled" />				<input type="checkbox" class="checkbox" id="checkbox2_d" disabled="disabled" />				<label for="checkbox_d"> 禁用的input.checkbox </label>			</p>			<p>				<input type="file" class="file" id="file" size="20" value="file selector 文件选择器" />				<label for="file"> input.file </label>			</p>			<p>				<input type="file" class="file" id="file_d" size="20" value="file selector 文件选择器" disabled="disabled" />				<label for="file_d"> 禁用的input.file </label>			</p>			<p>				<button><img />&lt;button&gt; 标签</button>				<button disabled="disabled"><img />禁用的&lt;button&gt; 标签</button>			</p>						<p>				<label for="textarea">&lt;textarea&gt;默认是底部对齐</label>				<textarea name="textarea" cols="60" rows="5" id="textarea">textarea 多行文本框。	它内部也是类似预格式的，能够将所有的回车符，制表符显示出来</textarea>				<textarea name="textarea" cols="20" rows="5" id="textarea_b" disabled="disabled">禁用的textarea 多行文本框</textarea>			</p>						<p>				<select name="textarea">					<option>drop-down selector 下拉选框</option>					<optgroup label="这是第一组">						<option>选项可以用&lt;optgroup&gt;分组</option>						<option>并由其label属性指定组名</option>					</optgroup>					<optgroup label="这是第二组">						<option>组名只是一个提示文字，不是选项</option>					</optgroup>				</select>				<select multiple="multiple" name="textarea">					<option>当&lt;select&gt;的size属性大于1或指定了multiple属性</option>					<option>就会成为这样的多行选框</option>				</select>				<select name="textarea" disabled="disabled">					<option>禁用的下拉选框</option>					<option>就会成为这样的多行选框</option>				</select>			</p>		</fieldset>	</form> </body></html>]]></HTMLmarkup><NoMemoryLeakEventBind author="" date="" common=""><![CDATA[<p>
<q><strong>只要DOM的事件里访问不了DOM自己的那个变量就行了</strong></q>
<cite>winter</cite>
</p>
<button id="testx">No Memory Leak Event Bind</button>
<button id="testy">No Memory Leak Event Bind</button>

<script type="text/javascript">
var fooA = function(){
    var f = function(){alert(this+'\n'+fooA);}
    !function(){
        var d = document.getElementById('testx');
        d.onclick = f;
    }()
}
fooA();

var fooB = function(){
    this.onclick = function(){alert(this+'\n'+fooB);}
}

fooB.call(document.getElementById('testy'));
</script>]]></NoMemoryLeakEventBind><YUIFonts author="" date="" common=""><![CDATA[px  	%
10 	77
11 	85
12 	93 (was 93)
13 	100
14 	108 (was 107)
15 	116 (was 114)
16 	123.1 (was 122)
17 	131 (was 129)
18 	138.5 (was 136)
19 	146.5 (was 144)
20 	153.9 (was 152)
21 	161.6 (was 159)
22 	167
23 	174
24 	182
25 	189
26 	197]]></YUIFonts><ArrayOrder author="dh20156" date="" common="数组排序"><![CDATA[<script type="text/javascript">
var x = [483,67,888,50,255,406,134,592,657,745,683];

var bf = function(list){//bubble sort
    if(!list){return;}
    list = list.slice(0);
    var i = 0,l = list.length,flag = true,x = null,y = null;
    for(;i<l-1;i++){
        flag = false;
        for(var j=i+1;j<l;j++){
            x = list[i];y = list[j];
            if(x>y){list[i] = [y,list[j]=x][0];flag = true;}
        }
        if(!flag){break;}
    }
    return list.slice(0);
};

document.write(bf(x)+'<br/>');

var dbf = function(list){//cocktail sort
    if(!list){return;}
    list = list.slice(0);
    var i = 0,l = 0,r = list.length-1,flag = true,x = null,y = null;
    while(flag){
        flag = false;
        for(i=l;i<r;i++){
            x = list[i];y = list[i+1];
            if(x>y){list[i] = [y,list[i+1]=x][0];flag = true;}
        }
        r--;
        for(i=r;i>l;i--){
            x = list[i];y = list[i-1];
            if(x<y){list[i] = [y,list[i-1]=x][0];flag = true;}
        }
        l++;
    }
    return list.slice(0);
};

document.write(dbf(x)+'<br/>');

var qsort = function (list){//quick sort
    if(!list){return;}
    list = list.slice(0);
    var run = function(list,left,right){
        var l = left,r = right,p = list[((l+r)>>1)];
        while(l<r){
            while(list[l]<p){l++;}
            while(list[r]>p){r--;}
            list[l] = [list[r],list[r]=list[l]][0];
        }
        if(left<r){arguments.callee(list,left,l-1);}
        if(right>l){arguments.callee(list,r+1,right);}
    };
    run(list,0,list.length-1);
    return list.slice(0);
};

document.write(qsort(x)+'<br/>');

var bsn = function(list){//bucket sort
    if(!list){return;}
    list = list.slice(0);
    var maxlen = function(list){
        if(!list){return 0;}
        var m = list[0];
        for(var i=0;i<list.length;i++){
            if(list[i]>m){m = list[i];}
        }
        return m.toString().length;
    };
    var i = 0,d = maxlen(list),dn = d,k = null,m = null,tmpa = [],l = list.length;
    while(d>0){
	for(i=0;i<10;i++){tmpa[i] = [];}
        for(i=0;i<l;i++){
            m = list[i];
            k = (new Array(dn).join(0)+m).slice(-dn).substr(d-1,1);
            tmpa[k].push(m);
        }
        list.length = 0;
        for(n in tmpa){list = list.concat(tmpa[n]);}
        tmpa.length = 0;
	d--;
    }
    return list.slice(0);
};

document.write(bsn(x)+'<br/>');

</script>]]></ArrayOrder><displacement author="dh20156" date="" common="左右位移"><![CDATA[<script type="text/javascript">

document.write('<h1>有符号右位移：</h1>');
document.write('(10>>1) = '+(10>>1)+'<br/>');
document.write('Math.floor(10/Math.pow(2,1)) = '+Math.floor(10/Math.pow(2,1))+'<br/>');

document.write('(-10>>2) = '+(-10>>2)+'<br/>');
document.write('Math.floor(-10/Math.pow(2,2)) = '+Math.floor(-10/Math.pow(2,2))+'<br/>');

document.write('(10>>3) = '+(10>>3)+'<br/>');
document.write('Math.floor(10/Math.pow(2,3)) = '+Math.floor(10/Math.pow(2,3))+'<br/>');

document.write('<h1>有符号左位移：</h1>');
document.write('(10<<1) = '+(10<<1)+'<br/>');
document.write('Math.floor(10)*Math.pow(2,1)) = '+Math.floor(10)*Math.pow(2,1)+'<br/>');

document.write('(-10<<2) = '+(-10<<2)+'<br/>');
document.write('Math.floor(-10)*Math.pow(2,2) = '+Math.floor(-10)*Math.pow(2,2)+'<br/>');

document.write('(10<<3) = '+(10<<3)+'<br/>');
document.write('Math.floor(10)*Math.pow(2,3) = '+Math.floor(10)*Math.pow(2,3)+'<br/>');

document.write('<h1>无符号右位移：</h1>');
document.write('(10>>>1) = '+(10>>>1)+'<br/>');
document.write('Math.floor(10/Math.pow(2,1)) = '+Math.floor(10/Math.pow(2,1))+'<br/>');

document.write('(10>>>2) = '+(10>>>2)+'<br/>');
document.write('Math.floor(10/Math.pow(2,2)) = '+Math.floor(10/Math.pow(2,2))+'<br/>');

document.write('(-1>>>2) = '+(-1>>>2)+'<br/>');
document.write('Math.pow(2,32)/Math.pow(2,2)-Math.floor(1/Math.pow(2,2))-1 = '+(Math.pow(2,32)/Math.pow(2,2)-Math.floor(1/Math.pow(2,2))-1)+'<br/>');

document.write('(-10>>>2) = '+(-10>>>2)+'<br/>');
document.write('Math.pow(2,32)/Math.pow(2,2)-Math.floor(10/Math.pow(2,2))-1 = '+(Math.pow(2,32)/Math.pow(2,2)-Math.floor(10/Math.pow(2,2))-1)+'<br/>');

document.write('(-10>>>3) = '+(-10>>>3)+'<br/>');
document.write('Math.pow(2,32)/Math.pow(2,3)-Math.floor(10/Math.pow(2,3))-1 = '+(Math.pow(2,32)/Math.pow(2,3)-Math.floor(10/Math.pow(2,3))-1)+'<br/>');
</script>]]></displacement><idAsIndex author="" date="" common="使用id当索引"><![CDATA[<span id="x">a</span>

<script type="text/javascript">

alert(document.getElementsByTagName("span").x)

</script>]]></idAsIndex><watch author="" date="" common=""><![CDATA[<input type="text" id="o" onkeyup='alert(this.value);' onchange='alert(this.value);' onpropertychange='alert(this.value);'>
<input type="button" value="change" onclick="document.getElementById('o').value='changed';">

<script type="text/javascript">

var d =document.getElementById('o');

d.watch("value",
   function (p, oldval, newval) {
      alert("o." + p + " changed from " + this[p] + " to " + newval);
      return newval;
});

</script>]]></watch><quadronicaGame author="dh20156" date="" common="圈地游戏"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="utf-8" />
<title>quadronica Game</title>
<meta name="Author" content="dh20156风之石" />
</head>
<body>

<div>1.玩家需要画出一个矩形，且矩形的四个角都是相同的颜色，矩形就会消除并得分。</div>
<div>2.可以直接点击矩形的对角来消除矩形</div>

<div id="x">x</div>

<script type="text/javascript">

var block = function(scolor,ix,iy,callback,scope){
	this.color = scolor;
	this.x = ix;
	this.y = iy;
	this.on = false;
	this.onselectstart = function(){return false;}
	this.onclick = function(){callback.call(scope,this);};
};

var grid = function(dbox,iw,ih,acolor){
	this.dbox = dbox;
	this.scroebox = null;
	this.grid = null;
	this.acolor = acolor;
	this.perWidth = 30;
	this.perHeight = 30;
	this.score = 0;
	this.initGrid = function(){
		var dx = '<tr><td>'+new Array(iw+1).join('●</td><td>')+'</td></tr>';
		var dy = new Array(ih+1).join(dx);
		var igw = document.all?this.perWidth*iw:this.perWidth*iw+4*iw;
		var igh = document.all?this.perHeight*ih:this.perHeight*ih+4*ih;
		this.dbox.style.textAlign = 'center';
		this.dbox.innerHTML = '<div><strong>Score:</strong><strong>0</strong></div><table cellpadding="0" cellspacing="0" align="center" style="border:1px inset;table-layout:fixed;width:'+(igw)+'px;height:'+(igh)+'px;">'+dy+'</table>';
		dx = dy = null;
		this.scroebox = this.dbox.childNodes[0].childNodes[1];
		this.grid = this.dbox.childNodes[1];
	};
	this.getColor = function(){
		var acolor = this.acolor,l = acolor.length-1;
		return acolor[Math.round(Math.random()*l)];
	};
	this.getLength  = function(o){
		var i = 0;
		for(var each in o){i++;}
		return i;
	};
	this.bucket = [];
	this.firstColor = null;
	this.getScroe = function(p0,p1){
		return (Math.abs(p0[0]-p1[0])+1)*(Math.abs(p0[1]-p1[1])+1)*5;
	};
	this.setScroe = function(iScroe){
		this.score += iScroe;
		this.scroebox.innerHTML = this.score;
	};
	this.reset = function(){
		var bkt = this.bucket,grid = this.grid,dtmp = null;
		for(var each in bkt){
			dtmp = grid.rows[bkt[each].x].cells[bkt[each].y];
			dtmp.style.color = dtmp.color;
			dtmp.style.borderStyle = 'outset';
		}
		this.bucket = [];
		this.firstColor = null;
		this.setScroe(-50);
		dtmp = null;
	};
	this.toggle = function(dobj){
		dobj.on = true;
		dobj.style.borderStyle = 'inset';
		dobj.style.color = 'white';
		var x = dobj.x,y = dobj.y,c = dobj.color;
		this.bucket[x+''+y] = {'x':x,'y':y,'color':c};
	};
	this.checkIn = function(o){
		var bkt = this.bucket,bktl = this.getLength(this.bucket),grid = this.grid;
		var x = o.x,y = o.y,c = o.color,bc = this.firstColor,xt = -1,yt = -1;
		if(o.on){
			o.on = false;
			o.style.color = o.color;
			o.style.borderStyle = 'outset';
			delete this.bucket[x+''+y];
			return false;
		}
		var clear = function(dobj,p0,p1){
			dobj.style.color = 'white';
			this.setColor(p0,p1);
			this.bucket = [];
			this.firstColor = null;
		};
		if(!bktl){this.firstColor = c;this.toggle(o);return true;}
		if(bktl>3){this.reset();return false;}
		if(c!=bc){this.reset();return false;}
		this.toggle(o);
		var tmpPoint = null,i=0;
		for(var p in bkt){
			tmpPoint = bkt[p];
			if(tmpPoint.x!=x&&tmpPoint.y!=y&&bktl%2){
				if(grid.rows[tmpPoint.x].cells[y].color!=bc||grid.rows[x].cells[tmpPoint.y].color!=bc){this.reset();return false;}
				this.setScroe(this.getScroe([tmpPoint.x,tmpPoint.y],[x,y]));
				this.setColor([tmpPoint.x,tmpPoint.y],[x,y],'black');
				window.setTimeout(function(scope){return function(){clear.call(scope,o,[tmpPoint.x,tmpPoint.y],[x,y])};}(this),300);
				return true;
			}
			if(tmpPoint.x==x){xt++;}
			if(tmpPoint.y==y){yt++;}
		}
		if(xt>1||yt>1){this.reset();return false;}
	};
	this.setColor = function(a0,a1,scolor){
		var grid = this.grid,x0 = (a0[0]<a1[0])?a0[0]:a1[0],y0 = (a0[1]<a1[1])?a0[1]:a1[1],x1 = (a0[0]<a1[0])?a1[0]:a0[0], y1 =(a0[1]<a1[1])?a1[1]:a0[1],iw = this.perWidth,ih = this.perHeight;
		for(var i=x0;i<=x1;i++){
			for(var n=y0;n<=y1;n++){
				var color = scolor||this.getColor();
				grid.rows[i].cells[n].style.cssText = 'width:'+iw+'px;height:'+ih+'px;font-size:12px;text-align:center;background:'+color+';color:'+color+';border:2px outset;cursor:pointer;-moz-user-select:none;';
				block.call(grid.rows[i].cells[n],color,i,n,this.checkIn,this);
			}
		}
	};
};

var ox = new grid(document.getElementById('x'),9,9,['red','green','blue','yellow']);
ox.initGrid();
ox.setColor([0,0],[8,8]);

</script>
</body>
</html>]]></quadronicaGame><getStr author="dh20156" date="" common="取字符中文算两个"><![CDATA[<script type="text/javascript">

var getStr = function(str,n){
    var tmpStr = str.substr(0,n);
    var tmpCode = tmpStr.replace(/[^\x00-\xff]/g,'\r\n').split('');
    n = (tmpCode[n-1]=='\r')?n-2:n-1;
    var l = tmpCode.slice(0,n).join('').replace(/\r\n/g,'*').length+1;
    return tmpStr.substr(0,l);
};

alert(getStr('我ABC汉DE字',6));

</script>]]></getStr><Memoization author="dh20156" date="" common="斐波那契记忆优化法"><![CDATA[<script type="text/javascript">

var fibonacci = function(n){
    var rv = {'0':0,'1':1},l=0,r=0,i=0;
    document.write('<p>[Memoization Function] Run times:</p>');
    !function(n){
        document.write((++i)+'->');
        if(!(n in rv)){
            l = rv[(n-1)]||arguments.callee(n-1);
            r = rv[(n-2)]||arguments.callee(n-2);
            rv[n] = l+r;
        }
        return rv[n];
    }(n);
    l = r = null;
    document.write('<p>NO.'+n+' is:'+rv[n]+'</p>');
    document.write('<hr/>');
};

fibonacci(8);

var fibonacci2 = function(n){
    var i2 = 0;
    document.write('<p>[Recursion Function] Run times:</p>');
    var fb2 = function(n){
        document.write((++i2)+'->');
        return n<2?n:arguments.callee(n-1)+arguments.callee(n-2);
    };
    var rv = fb2(n);
    document.write('<p>NO.'+n+' is:'+rv+'</p>');
};
fibonacci2(8);
</script>]]></Memoization><Attributestart author="dh20156" date="" common=""><![CDATA[<h1>在IE下，Input控件的start属性默认值是fileopen</h1>
&lt;input id="t" type="text"&gt;
<input id="t" type="text">
<button onclick="gs()">show input attribute 'start'</button>

<script type="text/javascript">
var gs = function(){
    var d = document.getElementById('t');
    alert(t.getAttribute('start'));
};
</script>]]></Attributestart><dragMouseWrite author="" date="" common="鼠标拖动写字"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>鼠标拖动写字</title>
<style type="text/css">
* {
	-moz-user-select:none;
	border:0px;
}
#tips {
	width:850px;
	padding-top:8px;
	padding-bottom:8px;
	background:#999999;
	color:#FFFFFF;
	text-align:center;
	margin:auto;
	font-size:14px;
}
</style>
<script type="text/javascript">
var Is_Mouse_Down = false
var Is_First=1
function Create(evt){
	evt=evt?evt:window.event
	if(Is_Mouse_Down){
		if(evt.ctrlKey){
			Clean(evt)
		}
		else {
			Write(evt)
		}
	}
}
function Write(evt){
	evt=evt?evt:window.event
	var Obj_Nian=document.createElement("DIV")
	Obj_Nian.style.position="absolute"
	Obj_Nian.style.left=evt.clientX-10+"px"
	Obj_Nian.style.top=evt.clientY-10+"px"
	switch(Is_First){
		case 1:Obj_Nian.innerHTML="你";break;
		case 2:Obj_Nian.innerHTML="看";break;
		case 3:Obj_Nian.innerHTML="我";break;
		case 4:Obj_Nian.innerHTML="会";break;
		case 5:Obj_Nian.innerHTML="写";break;
		case 6:Obj_Nian.innerHTML="字";break;
		default:Obj_Nian.innerHTML="Error";break;
	}
	Is_First+=1
	if(Is_First==7){
		Is_First=1
	}
	Color_Nian="RGB("+Math.floor(Math.random()*100)+"%,"+Math.floor(Math.random()*100)+"%,"+Math.floor(Math.random()*100)+"%)"
	Obj_Nian.style.color=Color_Nian
	document.body.appendChild(Obj_Nian)
}
function Clean(evt){
	evt=evt?evt:window.event
	evt.srcObj=evt.srcElement?evt.srcElement:evt.target
	if(evt.srcObj.tagName=="DIV" && (evt.srcObj.innerHTML=="你" || evt.srcObj.innerHTML=="看" || evt.srcObj.innerHTML=="我" || evt.srcObj.innerHTML=="会" || evt.srcObj.innerHTML=="写" || evt.srcObj.innerHTML=="字")){
		evt.srcObj.innerHTML=""
	}
}
document.onmousedown=function(){Is_Mouse_Down=true}
document.onmousemove=Create
document.onmouseup=function(){Is_Mouse_Down=false}
</script>
</head>
<body onselectstart="javascript:return false">
<div id="tips">提示：按住鼠标左键不放，在页面中拖动即可写字 ; 同时按住ctrl和鼠标左键不放，在页面中拖动即可把字擦去</div>
</body>
</html>]]></dragMouseWrite><MouseLeave author="" date="" common=""><![CDATA[<style type="text/css">
div{background:#666;padding:20px;margin:0;width:500px;}
h3{background:#999;padding:20px;margin:0;}
a{display:block;background:#ccc;padding:20px;margin:0;}
</style>

<script type="text/javascript">
function isMouseLeave(e, handler){
    if (e.type != 'mouseout' && e.type != 'mouseover') return false;
    var reltg = e.relatedTarget ? e.relatedTarget : e.type == 'mouseout' ? e.toElement : e.fromElement;
    alert(reltg.tagName);
    while (reltg && reltg != handler){reltg = reltg.parentNode;}
    return (reltg != handler);
}
</script>

<div onmouseout="alert(isMouseLeave(event,this));">
<h3>
<a href="http://ww.v-ec.com/dh20156/">web前端专家dhtml精英俱乐部</a>
</h3>
</div>]]></MouseLeave><JSTemplete author="WC" date="" common=""><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>模板Test</title>
<script type="text/javascript">
var Template = function () {
	this.constructor = arguments.callee;
	this.context = '';
	this.repeaters = [];
};

Template.prototype = {
	
	NAME : '{#TEMPLATE-REPEATER-n#}', SNAME : '{#+repeater#}', ENAME : '{#-repeater#}'
	
	, escape : function(str) {
	//prototype 1.6.0_rc1
		return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
	}
	
	, each : function (list, handler) {
		var i = 0, l = list.length, result = [];
		for (; i < l ; i ++) result.push(handler(this.context, list[i], i));
		this.context = result.join('');
		return this;
	}
	
	, replace : function (handler) {
		this.context = handler(this.context);
		return this;
	}
	
	, parse : function () {
		var v = this.context;
		
		var tempSRegex = new RegExp(this.escape(this.SNAME));
		var tempRegex = new RegExp('(?:' + this.escape(this.SNAME) + '|' + this.escape(this.ENAME) + ')', 'g');
		var tempValue = '', tempLeft = '', tempRight = '';
		var depth = 0;
		next : while (tempSRegex.test(v)) {
			tempValue = RegExp.rightContext;
			v = RegExp.leftContext;
			while (tempRegex.test(tempValue)) {
				if (RegExp.lastMatch == this.SNAME) {
					depth ++;
				} else {
					if (depth == 0) {
						tempLeft = RegExp.leftContext, tempRight = RegExp.rightContext;
						v += this.NAME.replace('n', this.repeaters.length) + tempRight;
						this.repeaters.push(new this.constructor().init(tempLeft));
						tempRegex.lastIndex = 0;
						continue next;
					} else {
						depth --;
					}
				}
			}
			throw new Error('模版Repeater嵌套不规则');
		}
		this.context = v;
		return this;
	}
	
	, toString : function () {
		var _self = this;
		var regex = new RegExp(this.escape(this.NAME).replace('n', '[0-9]+'), 'g');
		var length = 0;
		
		return this.context.replace(regex, function () {
			return _self.repeaters[length ++];
		});
	}
	
	, init : function (context) {
		this.context = context;
		this.parse();
		return this;
	}
};
</script>
</head>
<body>
<div id="example">
    <ul>
        <li><strong><!--{#name1#}--></strong></li>
        <li>
        	<!--{#name2#}-->
            <ul>
                <!--{#+repeater#}-->
                <li><!--{#value#}--></li>
                <!--{#-repeater#}-->
            </ul>
        </li>
    </ul>
</div>
<script type="text/javascript">

window.onload = function () {
	var div = document.getElementById('example');
	
	var example = new Template();
	example.SNAME = '<!--{#+repeater#}-->';
	example.ENAME = '<!--{#-repeater#}-->';
	example.init(div.innerHTML);
	
	example.replace(function (v) { return v.replace('<!--{#name1#}-->', '测试模板'); });
	example.replace(function (v) { return v.replace('<!--{#name2#}-->', '测试列表'); });
	
	//根据html注释在IE里有列表空值时的问题
	example.repeaters[0].each('abcdef'.split(''), function(context, value, index) {
		return context.replace('<!--{#value#}-->', index + ' : ' + value);
	});
	//alert(div.innerHTML); 注上面指这里的repeater结束标记跑到li里面去了
	div.innerHTML = example;
};
</script>
</body>
</html>]]></JSTemplete><xround author="dh20156" date="" common=""><![CDATA[<SCRIPT type="text/javascript">
var a = [1.4,1.5,1.51,1.6];

var xround = function(fn,n){
    n = n||0;
    var z = fn.toString().split('.'),x = z[0],y = z[1]&&z[1].toString(),r = new RegExp('(\\d{'+n+'})(\\d)(\\d*)');
    y&&r.test(y)&&y.replace(r,function(s,a,b,c){
        if(b&&b>5){var t = a?'.'+(a*1+1):1;x = x*1+t;return s;}
        if(b&&b==5){var t = a?c?'.'+(a*1+1):'.'+a:c?1:0;x = x*1+t;return s;}
        if(a){x = x+'.'+a;}
        return s;
    });
    return x;
}

var foo = function(list){
    while(list.length){
        var n = list.shift();
        document.write('xround('+n+') = '+xround(n)+'<br/>');
    }
}

foo(a);
</SCRIPT>]]></xround><setTransparentBackgroundImage author="google" date="" common=""><![CDATA[<div id="t" style="width:400px;height:300px;background-color:#f00;"><a href="http://www.v-ec.com/browser/">主流WEB浏览器透明PNG精美大图ICON</a></div>

<script type="text/javascript">
var goog = {};
goog.style = {};
goog.style.setTransparentBackgroundImage = function(el, src) {
  var style = el.style;
  if ('filter' in style&&!(/webkit/i.test(navigator.appVersion))) {//webkit内核浏览器也支持filter但是又没有IE下的内容
    style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(' +
        'src="' + src + '", sizingMethod="crop")';
  } else {
    style.backgroundImage = 'url(' + src + ')';
    style.backgroundPosition = 'left top';
    style.backgroundRepeat = 'no-repeat';
  }
};

goog.style.setTransparentBackgroundImage(document.getElementById('t'),'http://www.v-ec.com/browser/chrome.png');
</script>]]></setTransparentBackgroundImage><selection author="" date="" common=""><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Editor_雅虎</title>

<script type="text/javascript">
var inp;

var initEditor = function(){
	inp = document.getElementById('editframe');
	var inp2 = window.frames['editframe'];
	var inp3 = window.frames.editframe;
	if(inp.contentWindow.document.designMode){
		inp.contentWindow.document.designMode = "on";
	}
	window.setTimeout(function(){
	inp.contentWindow.document.body.style.fontSize = "12px";
	inp.contentWindow.document.body.style.margin = "0";
	inp.contentWindow.document.body.style.padding = ".5em";
	inp.contentWindow.document.body.id = "rich_txt_editor";
	inp.contentWindow.document.getElementsByTagName("html")[0].style.width = "100%";
	inp.contentWindow.document.getElementsByTagName("html")[0].style.height = "100%";
	inp.contentWindow.document.getElementsByTagName("html")[0].style.cursor = "text";
	inp.contentWindow.focus();
	},100);
};

window.onload=initEditor;

function bold(){
    inp.contentWindow.document.execCommand('bold',false,null);
}

function insert(){
	var win = inp.contentWindow;
	var sel = (win.getSelection)? win.getSelection() : win.document.selection;
	if(sel.rangeCount == 0){return;}
	var range = (sel.getRangeAt)? sel.getRangeAt(0).cloneRange() : sel.createRange();
	if(range.startContainer){
		win.document.execCommand('insertHTML',false,'<img src="http://www.v-ec.com/browser/chrome.png" />');
	}else{
		var cnode = range.parentElement();
		while(cnode.tagName.toLowerCase() != "body"){
			cnode = cnode.parentNode;
		}
		if(cnode.id && cnode.id=="rich_txt_editor"){
			range.pasteHTML('<img src="http://www.v-ec.com/browser/chrome.png" />');
		}
	}
	win.focus();
}
</script>

</head>
<body>

<iframe name="editframe" id="editframe" frameborder="1"></iframe>

<button type="button" onclick="insert();">Insert</button>
<button onclick="bold();">bold</button>
</body>
</html>]]></selection><clearTagsWithout author="dh20156" date="" common=""><![CDATA[<input type="text" id="s" style="width:40%;" value="div">
<button style="width:55%;border:1px outset #d4d0c8;" onclick="doClear()">Clear Tags Without The Box's Value</button>
<hr/>
<textarea id="x" style="width:40%;height:80%;overflow:auto;">
<div id="mastheader" class="module">
<div class="hd">
	<div class="account-nav">
	欢迎您访问JSLab，请 <a href="www.jslab.org.cn">[登录]</a> <span>,</span> <a href="www.w3cgroup.com">[免费注册]</a> <span>,</span> <a href="#" class="fav">收藏</a>
	</div>
	<div class="head-link">
		<a href="www.easyui.org.cn" class="home">easyui</a>
		<span>|</span>
		<a href="#info" class="info">资讯</a>
		<span>|</span>
		<a href="#service" class="ad">服务</a>
	</div>
</textarea>
<textarea id="y" style="width:55%;height:80%;overflow:auto;">result</textarea>

<script type="text/javascript">
var doClear = function(){
    var ds = document.getElementById('s');
    var dx = document.getElementById('x');
    var dy = document.getElementById('y');
    dy.value = clearTagsWithout(dx.value,ds.value);
};
var clearTagsWithout = function(source,stag){
    var r = new RegExp('[^>]*?<(?:\\/?(?!'+stag+')\\b|[^\\/\\w])[^>]*?>','ig'),i = 1,sp = '',um = 0;
    try{
        return source.replace(/(?:<\!\-\-[\s\S]*?\-\->|(<[^>]*>)|[\r\n\s])/g,function(a,b){return (b||'');}).replace(r,'').replace(/>[^<]*?<(\/)?/g,function(a,b){if(b){i=(i<0)?0:i;sp = new Array(i).join(' ');i-=4;}else{i+=4;sp = new Array((i<0?0:i)).join(' ');}return '>\r\n'+sp+'<'+(b||'');});
    }catch(e){}finally{um=Math.abs(Math.ceil(i/4));(um)?alert('有'+um+'个'+stag+'标签未闭合！'):alert('所有的'+stag+'标签都是闭合的！');r=i=sp=um=source=stag=null;}
};
</script>]]></clearTagsWithout><CssMenuBar author="飘零雾雨" date="" common="纯CSS仿经典菜单栏"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-cn" />
<title>纯CSS仿IE经典菜单栏 - Powered by 飘零雾雨</title>
<meta name="description" content="这是一个仿微软的经典菜单栏" />
<meta name="keywords" content="仿微软, 菜单, 经典菜单" />
<meta name="author" content="Doyoe(飘零雾雨), dooyoe@gmail.com" />
<link rel="stylesheet" type="text/css" media="all" href="http://www.doyoe.com/model/xhtmlcss/menu/menu3/skin/style.css" />
</head>
<body>
<div id="dymenu">
<ul class="root">
<li>
	<!--[if IE]><a href="?"><table><tr><td><![endif]-->

	<h3>文件(<acronym>F</acronym>)</h3>
	<ul>
		<li><a href="#"><em>新建(N)</em><span>Ctrl+N</span></a></li>
		<li><a href="#"><em>打开(O)...</em><span>Ctrl+O</span></a></li>
		<li class="separate"><a href="#"><em>保存(S)</em><span>Ctrl+S</span></a></li>

		<li class="separate2"><a href="#"><em>另存为(A)...</em></a></li>
		<li><a href="#"><em>页面设置(U)...</em></a></li>
		<li><a href="#"><em>打印(P)...</em><span>Ctrl+P</span></a></li>
		<li class="separate"><a href="#"><em>打印预览(V)...</em></a></li>
		<li class="separate2">
			<!--[if IE]><a href="?"><table><tr><td><![endif]-->

			<h4 class="more"><em>发送(E)</em></h4>
			<ul>
				<li><a href="#"><em>电子邮件页面(P)...</em></a></li>
				<li><a href="#"><em>电子邮件连接(L)...</em></a></li>
				<li><a href="#"><em>桌面快捷方式(S)</em></a></li>
			</ul>
			<!--[if IE]></td></tr></table></a><![endif]-->

		</li>
		<li class="separate"><a href="#"><em>导入和导出(I)...</em></a></li>
		<li class="separate2"><a href="#"><em>属性(R)</em></a></li>
		<li><a href="#"><em>关闭(C)</em></a></li>
	</ul>
	<!--[if IE]></td></tr></table></a><![endif]-->
</li>
<li>

	<!--[if IE]><a href="?"><table><tr><td><![endif]-->
	<h3>编辑(<acronym>E</acronym>)</h3>
	<ul>
		<li><a href="#"><em>剪切</em><span>Ctrl+X</span></a></li>
		<li><a href="#"><em>复制</em><span>Ctrl+C</span></a></li>

		<li class="separate"><a href="#"><em>粘贴</em><span>Ctrl+V</span></a></li>
		<li class="separate separate2"><a href="#"><em>全选(A)</em><span>Ctrl+A</span></a></li>
		<li class="separate2"><a href="#"><em>查找(在当前页)(F)...</em><span>Ctrl+F</span></a></li>
	</ul>
	<!--[if IE]></td></tr></table></a><![endif]-->
</li>

<li>
	<!--[if IE]><a href="?"><table><tr><td><![endif]-->
	<h3>查看(<acronym>V</acronym>)</h3>
	<ul>
		<li>
			<!--[if IE]><a href="?"><table><tr><td><![endif]-->
			<h4 class="more"><em>工具栏(T)</em></h4>

			<ul>
				<li><a href="#"><em>菜单栏(M)</em></a></li>
				<li class="separate"><a href="#"><em>链接(L)</em></a></li>
				<li class="separate2 selected"><a href="#"><em>锁定工具栏(B)</em></a></li>
			</ul>
			<!--[if IE]></td></tr></table></a><![endif]-->	
		</li>
		<li class="selected"><a href="#"><em>状态栏(B)</em></a></li>

		<li class="separate"><a href="#"><em>浏览器栏(E)</em></a></li>
		<li class="separate2"><a href="#"><em>转到(O)</em></a></li>
		<li><a href="#"><em>停止(P)</em><span>Esc</span></a></li>
		<li class="separate"><a href="#"><em>刷新(R)</em><span>F5</span></a></li>
		<li class="separate2">
			<!--[if IE]><a href="?"><table><tr><td><![endif]-->

			<h4 class="more"><em>文字大小(X)</em></h4>
			<ul>
				<li><a href="#"><em>最大(G)</em></a></li>
				<li><a href="#"><em>较大(L)</em></a></li>
				<li><a href="#"><em>中(M)</em></a></li>
				<li><a href="#"><em>较小(S)</em></a></li>

				<li><a href="#"><em>最小(A)</em></a></li>
			</ul>
			<!--[if IE]></td></tr></table></a><![endif]-->	
		</li>
		<li class="separate"><a href="#"><em>编码(D)</em></a></li>
		<li class="separate2"><a href="#"><em>源文件(C)</em></a></li>
		<li><a href="#"><em>隐私报告(V)...</em></a></li>

		<li><a href="#"><em>全屏显示(F)</em><span>F11</span></a></li>
	</ul>
	<!--[if IE]></td></tr></table></a><![endif]-->
</li>
<li>
	<!--[if IE]><a href="?"><table><tr><td><![endif]-->
	<h3>收藏(<acronym>A</acronym>)</h3>

	<ul>
		<li class="separate"><a href="#"><em>添加到收藏夹(A)...</em></a></li>
		<li class="separate separate2"><a href="#"><em>整理收藏夹(O)...</em></a></li>
		<li class="separate2 file"><a href="#"><em>链接</em></a></li>
		<li class="web"><a href="http://www.doyoe.com/" title="飘雨社区 - 致力于web前端"><em>飘雨社区 - 致力于web前端</em></a></li>
		<li class="web"><a href="http://blog.doyoe.com/" title="css探索之旅 - 飘零雾雨的庄园"><em>css探索之旅 - 飘零雾雨的庄园</em></a></li>

		<li class="web"><a href="http://www.jslab.org.cn/" title="JSLab - JS实验室代码库"><em>JSLab - JS实验室代码库</em></a></li>
		<li class="web"><a href="http://www.w3cgroup.com/" title="W3C Group - WEB前端专家DHTML精英俱乐部"><em>W3C Group - WEB前端专家DHTML精英俱乐部</em></a></li>
		<li class="web"><a href="http://i0752.cn/blog/" title="David's Blog - Focus on Web Fornt-End Development"><em>David's Blog</em></a></li>
	</ul>
	<!--[if IE]></td></tr></table></a><![endif]-->
</li>
<li>
	<!--[if IE]><a href="?"><table><tr><td><![endif]-->

	<h3>工具(<acronym>T</acronym>)</h3>
	<ul>
		<li><a href="#"><em>邮件和新闻(M)</em></a></li>
		<li><a href="#"><em>弹出窗口阻止程序(P)</em></a></li>
		<li class="separate"><a href="#"><em>管理加载项(A)...</em></a></li>
		<li class="separate2"><a href="#"><em>同步(S)...</em></a></li>

		<li class="separate"><a href="#"><em>Window Update(U)</em></a></li>
		<li class="separate2"><a href="#"><em>Internet 选项(O)...</em></a></li>
	</ul>
	<!--[if IE]></td></tr></table></a><![endif]-->
</li>
<li>
	<!--[if IE]><a href="?"><table><tr><td><![endif]-->
	<h3>帮助(<acronym>H</acronym>)</h3>

	<ul>
		<li class="separate"><a href="#"><em>目录和索引(C)</em></a></li>
		<li class="separate2"><a href="#"><em>每日提示(D)</em></a></li>
		<li><a href="#"><em>Netscape 用户(N)</em></a></li>
		<li><a href="#"><em>联机支持(S)</em></a></li>
		<li class="separate"><a href="#"><em>发送反馈意见(K)</em></a></li>

		<li class="separate2"><a href="#"><em>关于 Internet Explorer(A)</em></a></li>
	</ul>
	<!--[if IE]></td></tr></table></a><![endif]-->
</li>
</ul>
</div>
<p class="copyright">&copy; Copyright <a href="http://blog.doyoe.com/" title="css探索之旅 - 飘零雾雨的庄园">doyoe.com</a></p>
</body>
</html>]]></CssMenuBar><clearRepeat author="dh20156" date="" common="去掉数中重复的数字"><![CDATA[<script type="text/javascript">

var dN = function(num,len){
    var s = num.toString().replace(/(?:^[^\d]*0*|[^\d])*/g,'').split('').reverse().join('').replace(/(\d)(?=.*\1)/g,'').split('').reverse();
    s.length =len;
    return s.slice(0).join('');
};

alert(dN(-0.233641464278,4));
alert(dN(-0.303545,3));
alert(dN(33766545,4));

</script>]]></clearRepeat><getIndexFromArrayOrString author="dh20156" date="" common="取指定字符出现在数组或字符串中的位置"><![CDATA[<script type="text/javascript">

var x = [10,12,3,1,2,5,8];
var y = 'javascript和css代码库实验室';
var z = 'http://www.jslab.org.cn';

var getIndexFromAoS = function(s,splits,str){
    var r = new RegExp('(?:^|'+splits+')'+str+'(?:'+splits+'|$)','ig');
    var t = (s.constructor==Array)?s.join(splits).split(r):s.split(r);
    return (t.length>1)?(!t[0])?0:t[0].split(splits).length:-1;
};

alert('2，在\n'+x+'\n的第'+getIndexFromAoS(x,',',2));
alert('室，在\n'+y+'\n的第'+getIndexFromAoS(y,'','室'));
alert('jslab，在\n'+z+'\n的第'+getIndexFromAoS(z,'','jslab'));

</script>]]></getIndexFromArrayOrString><expandArray author="月MM" date="" common="扩展Array对象"><![CDATA[<script type="text/javascript">
var MyArray = function(){
    var ret = Array.prototype.slice.call(arguments,0);
    ret.myProperty = "myProperty";
    ret.myMethod = function(){
        alert(ret.myProperty);
    }
    return ret;
};

var x = new MyArray(1,2,3);
x.myProperty = 'x';
x.myMethod();
alert(x);
x.push(4);
alert(x);
alert(x.length);
</script>]]></expandArray><ConstructorFunctionReturn author="dh20156" date="" common="构造函数中的return"><![CDATA[<script language="javascript">

function a(s){
    return s;
}
function b(s){
    return new String(s);//构造函数中的return只有返回对象时才会覆盖new的结果
}

var x = new a("123");
alert(x.constructor);
alert(x.toString());

var y = new b("123");
alert(y.constructor);
alert(y.toString());

</script> ]]></ConstructorFunctionReturn><undefined author="" date="" common=""><![CDATA[<script type="text/javascript">
var a;
alert(a);
a += 'A';
alert(a);
</script>]]></undefined><addDqmForPP author="dh20156" date="" common="给标签内属性值加上双引号"><![CDATA[<textarea id="t" style="height:300px; width:600px;">
<UL class=list>
<LI class=feed_item><SPAN class=note>01/12/2008</SPAN>
<P><A title=GE公司推出“汪力和李邦”网络广告 href=http://www.genewscenter.com/{$content}\Detail.asp?ReleaseID=4886&amp;NewsAreaID=2&amp;changeCurrentLocale=5 _eventID="4">GE公司推出“汪力和李邦”网络广告</A></P></LI>
<LI class=feed_item><SPAN class=note>26/11/2008</SPAN>
<P><A title=GE石油天然气集团在中国创造新的快速安装记录 href="http://www.genewscenter.com/content/Detail.asp?ReleaseID=4879&amp;NewsAreaID=2&amp;changeCurrentLocale=5" _eventID="5">GE石油天然气集团在中国创造新的快速安装记录</A></P></LI></UL>
</textarea>



<script type="text/javascript">
var sa = '<a href=index.html>hello </a><input  onlick=a();  typle="submit"/><input  onlick=a(); value=ok  typle="submit"/><span>a=8+4</span>';

var sb = document.getElementById('t').value;

var addDqmForPP = function(shtml){
    return shtml.replace(/( [^\=]*\=)(\s?[^\"\s\>]*)/ig,function(a,b,c,d,e){return (c)?(new RegExp("<[^>]*"+c.replace(/(\^|\(|\)|\[|\]|\{|\}|\?|\-|\\|\/|\||\$)/g,'\\$1')+"[^>]*>","i").test(e))?b+'"'+c+'"':b+c:b});
};

alert(addDqmForPP(sa));

alert(addDqmForPP(sb));
</script>]]></addDqmForPP><addDqmForPP author="WC" date="" common="给标签内属性值加上双引号标记变小写"><![CDATA[<textarea style="height:300px; width:600px;">
<UL class=list>
<LI class=feed_item><SPAN class=note>01/12/2008</SPAN>
<P><A title=GE公司推出“汪力和李邦”网络广告 href="http://www.genewscenter.com/content/Detail.asp?ReleaseID=4886&amp;NewsAreaID=2&amp;changeCurrentLocale=5" _eventID="4">GE公司推出“汪力和李邦”网络广告</A></P></LI>
<LI class=feed_item><SPAN class=note>26/11/2008</SPAN>
<P><A title=GE石油天然气集团在中国创造新的快速安装记录 href="http://www.genewscenter.com/content/Detail.asp?ReleaseID=4879&amp;NewsAreaID=2&amp;changeCurrentLocale=5" _eventID="5">GE石油天然气集团在中国创造新的快速安装记录</A></P></LI></UL>
</textarea>
<script type="text/javascript">
var partialXHTML = function (value) {
    return value.replace(/<(\/?[a-zA-Z]+\s*)((?:"[^"]*"|'[^']*'|(?!'|"|\/?>).)*)(\/?>)/g, function (l, $1, $2, $3) {
        return '<' + $1.toLowerCase() + $2.replace(/([^=]+)=(?:(")[^"]*"|(')[^']*'|((?:(?!\s|'|"|\/?>).)*))/g, function (l, $1, $2, $3, $4) {
            return ($2||$3) ? l : $1 + '="' + $4 + '"';
        }) + $3;
    });
};
var parse = function (t) {
    t.value = partialXHTML(t.value);
};
</script>
<input type="button" value="修正" onclick="parse(document.getElementsByTagName('textarea')[0])" />]]></addDqmForPP><scrollLeftRight author="dh20156" date="" common="左右方向无缝滚动"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-cn" />
<title>来自web developer navigator!的dhScroll Ver2.0.0 左右横向无缝滚动</title>
<style type="text/css">
/*块1样式*/
#scroll {width:600px;height:250px;overflow:hidden;}
/*块2样式*/
.mqdemoa {width:6000px!important;width:3000px;margin:0;padding:0;}
/*块2子元素样式*/
.mqdemoa li {width:148px;margin:0 1px;height:250px;background:red;float:left;list-style:none;}

/*其他样式，与scroll对象无关联*/
#prenext {width:600px;height:20px;overflow:hidden;}
#prenext span {display:block;font:12px "宋体";width:50%;height:20px;line-height:20px;text-align:center;cursor:pointer;color:#fff;background:#000;}
#prenext .pre {float:left;}
#prenext .next {float:right;}
</style>
<script type="text/javascript">
function dhscroll(){
	//author:dh20156
	var dh = this;
	this.autoid = null;
	//块1
	this.scrollDOM = null;
	//块2
	this.scrollCDOM = null;
	//展示宽度（和块1宽度一致）
	this.showwidth = 0;
	//每次滚动长度，这个值要能被this.showwidth整除才行
	this.steplength = 20;
	var oldlength = this.steplength;
	//滚动时间间隔
	this.steptime = 1;
	//停顿时间
	this.resttime = 3000;
	//滚动长度
	this.uvwidth = 0;

	//无缝设置过程
	this.getsw = function(){
		var tempw = this.scrollCDOM.offsetWidth;
		var temps = this.scrollCDOM.innerHTML;
		this.scrollCDOM.innerHTML = [temps,temps].join("");
		this.scrollCDOM.style.width = tempw*2+"px";
		if(document.attachEvent){
			this.scrollDOM.attachEvent("onmouseover",dh.pause);
			this.scrollDOM.attachEvent("onmouseout",dh.goon);
		}else{
			this.scrollDOM.addEventListener("mouseover",dh.pause,true);
			this.scrollDOM.addEventListener("mouseout",dh.goon,true);
		}
		this.uvwidth = Math.ceil(this.scrollDOM.scrollWidth / 2);
	}

	//从右到左
	this.scrollleft = function(){
		if(this.autoid!=null){
			window.clearTimeout(this.autoid);
		}
		var uvleft = this.scrollDOM.scrollLeft;
		uvleft += this.steplength;

		this.scrollDOM.scrollLeft = uvleft;

		if(uvleft>=this.uvwidth){
			this.scrollDOM.scrollLeft = 0;
		}
		
		if(uvleft % this.showwidth == 0){
			if(this.autostart){this.autoid = window.setTimeout(function(){dh.scrollleft()},dh.resttime);}
		}else{
			this.autoid = window.setTimeout(function(){dh.scrollleft()},dh.steptime);
		}
		document.getElementById("s").innerHTML = this.uvwidth+","+uvleft;
	}

	//从左到右
	this.scrollright = function(){
		if(this.autoid!=null){
			window.clearTimeout(this.autoid);
		}
		var uvleft = this.scrollDOM.scrollLeft;
		uvleft -= this.steplength;

		this.scrollDOM.scrollLeft = uvleft;

		if(uvleft <= 0){
			this.scrollDOM.scrollLeft = this.uvwidth;
		}

		if(uvleft % this.showwidth == 0){
			if(this.autostart){this.autoid = window.setTimeout(function(){dh.scrollright()},dh.resttime);}
		}else{
			this.autoid = window.setTimeout(function(){dh.scrollright()},dh.steptime);
		}
		document.getElementById("s").innerHTML = this.uvwidth+","+uvleft;
	}

	//开始滚动，参数为方向，首屏是否停顿
	this.go = function(direction,rest){
		this.autostart = true;
		if(this.autoid!=null){
			window.clearTimeout(this.autoid);
		}
		if(direction=="left"){
			if(rest){
				this.autoid = window.setTimeout(function(){dh.scrollleft()},5000);
			}else{
				dh.scrollleft();
			}
		}else{
			if(rest){
				this.autoid = window.setTimeout(function(){dh.scrollright()},5000);
			}else{
				dh.scrollright();
			}
		}
	}

	//往右
	this.pre = function(){
			this.scrollright();
	}
	//往左
	this.next = function(){
			this.scrollleft();
	}
	//暂停
	this.pause = function(){
		dh.oldlength = dh.steplength;
		dh.steplength = 0;
	}
	//继续
	this.goon = function(){
		dh.steplength = dh.oldlength;
	}
}
</script>
</head>
<body>
<p id="s">scrollWidth, scrollLeft</p>

<div id="scroll">
<ul id="scroll2" class="mqdemoa">
	<li>测试1</li>
	<li>测试2</li>
	<li>测试3</li>
	<li>测试4</li>
	<li>测试5</li>
	<li>测试6</li>
	<li>测试7</li>
	<li>测试8</li>
	<li>测试9</li>
	<li>测试10</li>
	<li>测试11</li>
	<li>测试12</li>
	<li>测试13</li>
	<li>测试14</li>
	<li>测试15</li>
	<li>测试16</li>
	<li>测试17</li>
	<li>测试18</li>
	<li>测试19</li>
	<li>测试20</li>
</ul>
</div>
<div id="prenext">
	<span class="pre" onmouseover="this.style.background='#eee';this.style.color='#000'" onmouseout="this.style.background='#000';this.style.color='#fff'" onclick="dhs.pre();">上一页</span>
	<span class="next" onmouseover="this.style.background='#eee';this.style.color='#000'" onmouseout="this.style.background='#000';this.style.color='#fff'" onclick="dhs.next();">下一页</span>
</div>
<dl>
<dt><h1>dhScroll Ver2.0.0 左右横向无缝滚动</h1></dt>
<dd>支持从左到右，从右到左两个方向的无缝滚动；</dd>

<dd>支持手动更改滚动方向；</dd>
<dd>支持连续/停顿方式滚动；</dd>
<dd>鼠标指向暂停滚动，移开继续；</dd>
<dt><h1>滚动对象模型</h1></dt>
<dd>&lt;块1&gt;&lt;块2&gt;&lt;块2的子元素&gt;内容&lt;/块2的子元素&gt;&lt;/块2&gt;&lt;/块1&gt;</dd>
<dt><h1>滚动模型设置样式要点</h1></dt>

<dd>块1设置的宽度为展示宽度；overflow:hidden;</dd>
<dd>块2设置的宽度为块2子元素累计宽度（确保块2所有子元素排在一排）；</dd>
<dd>由于脚本中无缝部分采用innerHTML重写块2子元素，导致IE和FF在样式渲染上有所区别，FF下块2的宽度应设置为块2宽度的两倍；</dd>
<dd>块2子元素必须确保排在一排，非表格的话最好float:left;</dd>
</dl>

<script type="text/javascript">
var dhs = new dhscroll();
dhs.scrollDOM = document.getElementById("scroll");
dhs.scrollCDOM = document.getElementById("scroll2");
dhs.showwidth = 600;
dhs.getsw();
dhs.go("left",true);
</script>
</body>
</html>]]></scrollLeftRight><clearInputFileValue author="dh20156" date="" common="清除文件选择框中的内容"><![CDATA[<input type="file" id="x" /><button onclick="clearf();">clear</button>

<script type="text/javascript">
var clearf = function(){
    var dx = document.getElementById('x');
    dx.value = '';
    if(document.selection){
        dx.select();
        document.selection.clear();
    }
};
</script>]]></clearInputFileValue><bigNumPow author="月MM" date="" common="n次方大数计算"><![CDATA[<script type="text/javascript">
function bigNumMulti(a,b){
	var p = a.match(/\d{1,4}/g).reverse();
	var q = b.match(/\d{1,4}/g).reverse();
	var f1 = 0;
	var result = "0";

	for(var i = 0; i < p.length; i++){
		var f2 = 0;
		for(var j = 0; j < q.length; j++){
			var t = (p[i]|0)*(q[j]|0);
			t += new Array(f1+f2+1).join("0");
			result = bigNumAdd(result, t);
			f2 += q[j].length;
		}
		f1 += p[i].length;
	}
	return result;
}
function bigNumAdd(a,b){
	var m = a.split('').reverse();
	var n = b.split('').reverse();
	var ret = [];
	var s = 0;

	for(var i = 0; i < a.length || i < b.length; i++){
		var t = (m[i]|0) + (n[i]|0) + s;

		ret.push(t%10);
		s = (t/10)|0;
	}
	if(s){
		ret.push(s);
	}
	return ret.reverse().join('');
}

function bigNumPow(a,b){
	var ret = "1";
	for(var i = 0; i < b; i++){
		ret = bigNumMulti(ret,a.toString());
	}
	return ret;
}
document.write(bigNumPow(36,50));
</script>]]></bigNumPow><bigNumPow author="javeejy" date="" common="n次方大数计算"><![CDATA[ <script>
 var g = [200*200];
 function mul(A, B) {
 	var i,j,len,k,rt;
 	var m = A.length, n = B.length, t;
 	//矩阵乘
 	for(i=0;i<m;i++){
 		t = A[i];
 		for(j=0;j<n;j++){
 			g[i*n+j] = B[j]*t;
 		}
 	}

 	len = i+j-1;
 	rt = new Array(len);
 	//清零
 	for(k=0;k<len;k++){
 		rt[k] = 0;
 	}
  //矩阵脚标和相等相加
  k = 0;
 	for(m=0;m<i;m++){
 		for(n=0;n<j;n++){
 			rt[(m+n)%len] += g[k+n];
 		}
 		k+=j;
 	}
 	i = rt.length-1;
 	A = [];
 	j=0;
 	for(;i>=0;i--){
 		//这里貌似可以优化
		n = (rt[i]%10)+j;
		j =((rt[i]/10)|0)+(n/10)|0;
 		A[A.length]=n%10;
 	}
 	if(j!=0)
 		A[A.length]=j;
 	return A.reverse();
 }
 
//例
var a = [3,6];
document.write('<h2>36的N次方</h2>');
for(var mm=0;mm<=100;mm++){
 	a = mul(a,[3,6]);
  	document.write('<p>36^'+(mm+2)+':'+a.join('')+'</p>');
}
 </script>]]></bigNumPow><FormatString author="月MM" date="" common="功能更强大的字符串格式化函数"><![CDATA[<html>
<head>
<title>功能更强大的字符串格式化函数</title>
</head>
<body>
<div id="template">This is a {t}. <br/>
{name}是一个很强大的字符串模板解析方法。<br/>
它接受三个参数，分别是{args.text},{args.object},（可选的）{args.decorator}<br/>
它最直接的用法是将{args.text}所表示的字符串中用"{{}"和"{}}"包含起来的字符串解析成object的属性。<br/>
例如: System.substitute("{{}a{}} love {{}b{}}.", {{}a:"I", b:"you"{}});<br/>
将得到{a} love {b}.<br/>
值得注意的是，模板替换可以支持多级属性替换，例如本例子中的{{}args.text{}}，还可以支持表达式<br/>
例如{{}x{}}+{{}y{}} = {{}x+y{}} => {x} + {y} = {x+y}
</div>
<br/>
<div id="test" style="border:solid 1px #3377cc">This is a {t}. <br/>
{name}是一个很强大的字符串模板解析方法。<br/>
它接受三个参数，分别是{args.text},{args.object},（可选的）{args.decorator}<br/>
它最直接的用法是将{args.text}所表示的字符串中用"{{}"和"{}}"包含起来的字符串解析成object的属性。<br/>
例如: System.substitute("{{}a{}} love {{}b{}}.", {{}a:"I", b:"you"{}});<br/>
将得到{a} love {b}.<br/>
值得注意的是，模板替换可以支持多级属性替换，例如本例子中的{{}args.text{}}，还可以支持表达式<br/>
例如{{}x{}}+{{}y{}} = {{}x+y{}} => {x} + {y} = {x+y}<br/>
关于转义：
这是{x}
这是{{}x{}}
这是{{}{x}{}}
这是{{{}x{}}}
</div>
<script type="text/javascript">
/**
 * 判定一个对象是否被定义过
 */
Object.defined = function(obj, prop){
	return typeof(obj) != 'undefined' && (prop == null || obj.hasOwnProperty(prop));
};
System = {};
System.substitute = function(s, o, f){
	
	var patternExpr = /\{([^\{\}]*)\}/g

	s = s.replace(patternExpr, function(s,a){
			if(!a) return '';

			try{
				var r = eval("with(o){"+s+"}");
				return Object.defined(r)?(f?f(r):r):'';
			}catch(ex){return "{"+s+"}";}
	});

	return s;
};

var text = document.getElementById("test").innerHTML;
document.getElementById("test").innerHTML = System.substitute(text, 
	{t:"Test", name:"System.subtitute",args:{text:"text", object:"object", decorator:"decorator"},
	 a:"I", b:"you",x:1, y:2}, 
	function(s){return '<font color="red">'+s+'</font>'});
</script>
</body>
</html>]]></FormatString><WebRegExp author="客服果果" date="" common="正则无忧-Web版助手工具"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title> WebRegExp 1.0 - 客服果果 [ 无忧版 ] </title>
<base href="http://www.dhooo.com/web/" />
<style type="text/css">
body{background:#2B3C53;}
*{font-size:12px;}
#win{
	width:900px;font-size:12px;
	position:absolute;left:0;top:0;
	background:#F1F0EA;
	border:2px outset;color:#000; 
	-moz-border-top-colors:#d4d0c8 white;
	-moz-border-left-colors: #d4d0c8 white;
	-moz-border-right-colors:#404040 #808080;
	-moz-border-bottom-colors:#404040 #808080;
}
h4{
	background:#35528E url(images/caption.jpg) repeat-y 100% 0; 
	margin:1px;padding:5px;cursor:default;
	color:#fff;font-size:14px;font-family:Arial;
}
h4 div{
	background:url(images/ico.gif) no-repeat 2px 0; 
	padding-left:25px;
}
#about{	text-decoration:none;color:#000;padding:2px}
.menu{line-height:20px;padding:0px 10px;display:none;}
.line{
	font-size:1px;	line-height:1px;
	background:#fff;	margin:0 2px;	height:1px;
	overflow:hidden;	border-top:1px solid #ACA899; 
}
.ad{
	background:#FF7B00 url(images/regexp_ad.gif) no-repeat 50% 50%;
	height:60px; position:relative; display:none;
}
.ibody{margin:5px;}
.left{
	width:250px;height:100%; 
	float:left;text-align:center; 
}
.btnWrap{padding:5px 0;}
button{+margin-left:2px;padding:0px; }
#tabBtns a{
	color:#000;text-decoration:none;
	display:block; float:left;margin-right:1px; 
	width:47px;height:20px;line-height:20px; 
	background:#fff url(images/tab.gif) no-repeat 0 0; 
}
.list_wrap{margin:5px;}
#tabBtns{z-index:10;border:0px solid #aaa; }
#tabBtns a:hover{
	background:url(images/tab.gif) no-repeat 0 -21px; 
}
#tabBtns a.hot,#tabBtns a.hot:hover{
	background:url(images/tab.gif) no-repeat 0 100%; 
	width:52px; height:20px; position:relative;bottom:-1px;
}
.list_option{
	background:#fff; margin:0px;padding:0px; 
	border:1px solid #919B9C;display:none;
}
#list_match.list_option{display:block;}
.right{width:636px;	float:right;}
.clear{clear:both;font-size:0px;overflow:hidden;height:0px; }
#colorText,textarea{
	margin:5px auto;height:100px; 
	overflow:auto;border:1px solid inset; 
}
#colorText{background:#fff;text-align:left;word-wrap:break-word;overflow:hidden;}
#regexpText{width:236px}
#replaceText{height:30px;}
#regexpText{height:200px;}
#replaceText,#targetText,#resultText{width:620px}
#targetText{height:200px;background:#ddd;color:#000; }
#resultText{height:200px;color:#0099FF}
select{width:216px;height:170px;margin:0px;padding:0px;margin-top:10px; }
fieldset{	text-align:center;padding:0; margin:10px 0 0 0}
legend{margin-left:10px;color:#000; }
</style>

</head>

<body>
<div id="win">
 <h4><div id="caption">WebRegExp 1.0 - 客服果果 [ 无忧版 ]</div></h4>
 <div class="menu"><a href="javascript:void(0)" id="about" onclick="alert('感谢使用WebRegExp 1.0')">关于(<u>A</u>)</a></div>
 <div class="line"></div>
 <div class="ad"></div>
 <div class="ibody">
	<div class="left">
		<fieldset>
			<legend>正则式输入</legend>
			<textarea id="regexpText"><[^>]+></textarea>
			<div class="btnWrap">
				<button id="doOut">输出</button>
				<button id="doTrim">剔除</button>
				<button id="doReplace">替换</button>
				<button id="doNext">查找下一个</button>
				<button id="doFind">列表</button>
			</div>
		</fieldset>
		<fieldset >
			<legend>模式匹配</legend>
			<label for="isI"><input type="checkbox" id="isI" m="i" />忽略大小写</label>
			<label for="isM"><input type="checkbox" id="isM" m="m" />多行模式</label>
			<label for="isG"><input type="checkbox" id="isG" m="g" checked />全局模式</label>
		</fieldset>
		<fieldset class="">
			<legend>常用正则式</legend>
			<div class="list_wrap">
				<div id="tabBtns">
					<a href="javascript:void(0)" title="">验证</a>
					<a href="javascript:void(0)" title="" class="hot">提取</a>
					<a href="javascript:void(0)" title="">剔除</a>
					<div class="clear"></div>
				</div>
				<div id="all_list">
					<div class="list_option" id="list_check">
						<select id="exps1" size="2"></select>			 
					</div>
					<div class="list_option" id="list_match">
						<select id="exps2" size="2"></select>			 
					</div>
					<div class="list_option" id="list_trim">
						<select id="exps3" size="2"></select>			 
					</div>
				</div>
			</div>
		</fieldset>
	</div>
	<div class="right">
		<fieldset>
			<legend>测试文本</legend>
			<textarea id="targetText">
<!-- testText-->
<table cellspacing="0" cellpadding="4" width="100%" align="center" class="t_row">
<tr style="height: 100%">
<td width="18%" valign="top" class="t_user"><a name="pid575004"></a> <a name="newpost"></a> <a href="space.php?uid=94039" target="_blank" class="bold">客服果果</a>
<br><div class="smalltxt">
爬虫<br>
<img src="images/default/star_level2.gif" alt="Rank: 2" /><br>
<br>
<table width="95%" border="0" cellspacing="0" cellpadding="0" style="table-layout: fixed; overflow: hidden">
<tr><td align="center"><div class="avatar" style="width: 70"><img src="images/avatars/16.gif" width="70" height="80" border="0" alt="" /></div></td></tr></table>
<!-- testText end-->
			</textarea>
		</fieldset>
		<fieldset >
			<legend>替换文本</legend>
			<textarea id="replaceText">dhooo</textarea>
		</fieldset>
		<fieldset>
			<legend id="reInfo">查找结果</legend>
			<textarea id="resultText"></textarea>
		</fieldset>
	</div>
	<div class="clear"></div>
 </div>
</div>
<script>
ldh={
	ex:function(main,ex){for(var k in (ex||{}))main[k]=ex[k];return main}
	,each:function(list,fn){for(var i=0;i<list.length;i++)fn.call(list[i],i,list)}
	,chk:function $chk(obj){return !!(obj || obj === 0)}
	,find:function(selector,box){
		if(typeof(selector)!='string')return selector;
		if(selector.charAt(0)=='.')return (function(className,box){
			var list=[];
			ldh.each(ldh.find('*',box),function (i){
				if(this.className.indexOf(className)!=-1)list.push(this)
			})
			return list;
		})(selector.replace('.',''),ldh.find(box));
		if(selector.charAt(0)=='#')return document.getElementById(selector.replace('#',''));
		return (ldh.find(box)||document).getElementsByTagName(selector);
	}
};

ldh.ex(ldh,{
	drag:function(hander,ini){
		ini=ldh.ex({win:false,dir:'xy'},ini);
		var mover=ini.win||hander;
		mover.style.position="absolute";
		hander.onmousedown=function (e){
			e=window.event||e;
			this.x=e.clientX-mover.offsetLeft;
			this.y=e.clientY-mover.offsetTop;
            if(document.all){
		        hander.onlosecapture=dragStop;
		        hander.setCapture();
	        }else{
		        window.onblur=dragStop;
	        }
			document.onmousemove=function(e){
				e=window.event||e;
				var x=e.clientX-hander.x,y=e.clientY-hander.y;
				ldh.chk(ini.left)&&(x=Math.max(x,ini.left));
				ldh.chk(ini.top)&&(y=Math.max(y,ini.top));
				ldh.chk(ini.right)&&(x=Math.min(x,ini.right));
				ldh.chk(ini.bottom)&&(y=Math.min(y,ini.bottom));
				if(ini.dir.indexOf('x')!=-1)mover.style.left=x+"px";
				if(ini.dir.indexOf('y')!=-1)mover.style.top=y+"px";
				if(document.all){	hander.setCapture();e.cancelBubble=true;
				}else{e.preventDefault();e.stopPropagation(); 
				}
				window.getSelection && window.getSelection().removeAllRanges();				
			};
			function dragStop(){
				document.onmousemove=document.onmouseup=null;
				if(document.all){hander.onlosecapture=null;hander.releaseCapture();
                }else{window.onblur=null}
			}
			document.onmouseup=dragStop;
		};
	}
})
$=ldh.find;
var Attr=function (key,value){return value?(this.setAttribute(key,value),this):this.getAttribute(key)};
var commad=function(){},prevPos=0,resultList=[];
ldh.each(ldh.find('INPUT'),function (){this.onclick=applySearch})
function applySearch(){
	var mode='',re,beginTime=new Date;
	ldh.each(ldh.find('INPUT'),function (){if(this.checked)mode+=Attr.call(this,'m')});
	if($('#regexpText').value==''){re=null}
	else{try{re=new RegExp($('#regexpText').value,mode)
		}catch(e){re=null}	
	}
	var mArr=String($('#targetText').value).match(re);
	$('#resultText').value='';
	if(!(mArr instanceof Array))mArr=[];
	resultList=mArr;
	var time='共耗时 <strong style="color:#009900">'+(new Date-beginTime)+"</strong> 毫秒"
	command(mArr,re,mode,time);
}
if(document.all){
	var rngTarget=$('#targetText').createTextRange(),firstRng=rngTarget.getBookmark();
}
function findText(text){ 
	if(!text)return;
	rngTarget.collapse(true); 
	if(rngTarget.findText(text)){ 
		rngTarget.select(); 
		rngTarget.collapse(false); 
	}else{
		rngTarget.moveStart('character',-$('#targetText').value.length);
	} 
} ;
(function (){
	$('#regexpText').onchange=function(){resultList=[];}
	$('#exps1').onchange=
	$('#exps2').onchange=
	$('#exps3').onchange=function (){$('#regexpText').value=this.value;resultList=[]};
	($('#doFind').onclick=function (){
			command=function(mArr,a,b,c){
				$('#reInfo').innerHTML='查找结果(共找到 <strong style="color:red">'+mArr.length+'</strong> 个匹配,'+c+')';
				if(mArr.length==0)return $('#resultText').value='没有找到匹配项';
				var txt=[];
				ldh.each(mArr,function (i){txt.push((i+1)+'. '+this+'\n')});
				$('#resultText').value=txt.join('');
			};
			applySearch();
	})();
	$('#doReplace').onclick=function (){
			command=function (mArr,re,b,c){
				$('#resultText').value=$('#targetText').value.replace(re,$('#replaceText').value);
				$('#reInfo').innerHTML='已替换 <strong style="color:red">'+mArr.length+'</strong> 个匹配项 ('+c+')'
			}
			applySearch();
	};
	$('#doTrim').onclick=function (){
			command=function (mArr,re,b,c){
				$('#resultText').value=$('#targetText').value.replace(re,'');
				$('#reInfo').innerHTML='已剔除 <strong style="color:red">'+mArr.length+'</strong> 个匹配项 ('+c+')'
			}
			applySearch();
	};
	$('#doOut').onclick=function (){
			command=function (mArr,re,mode,c){
				$('#resultText').value=$('#targetText').value.replace(re,'');
				$('#reInfo').innerHTML='JavaScript代码 ('+c+')';
				if(mArr.length==0)return $('#resultText').value='由于没有任何匹配项，所以未能输出正则表达式!';
				mode=mode?',"'+mode+'"':'';
				var txt=$('#regexpText').value.replace(/\\/g,'\\\\')
				$('#resultText').value='myRegExp=new RegExp("'+txt+'"'+mode+');';
			}
			applySearch();
	};
	$('#doNext').onclick=function (){
			if(resultList.length==0){applySearch()}
			var m=resultList.shift()
			findText(m);
			$('#resultText').value=m?m:'没有找到匹配项';
	}
	ldh.each($('A','#tabBtns'),function (i){
		this.index=i;
		this.onkeydown=blur;
		this.onclick=function (){
			var List=$('DIV','#all_list');
			var Btns=$('A','#tabBtns');
			ldh.each(Btns,function(){this.className=''});
			this.className='hot';
			ldh.each(List,function(){this.style.display='none'});
			List[this.index].style.display='block';
		}
	});
	ldh.each([
		{text:'合法帐号',value:'^[a-zA-Z][a-zA-Z0-9_]{4,15}$'	}
		,{text:'图片文件',value:'.*(.jpg|.jpeg|.gif|.png)$'}
		,{text:'E-mail',value:'^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$'}
		,{text:'身份证',value:'^\\d{15}|\\d{18}$'}
		,{text:'QQ号',value:'^[1-9]*[1-9][0-9]*$'}
		,{text:'全中文',value:'^[\\u4e00-\\u9fa5]+$'}
		,{text:'手机号码',value:'^13\\d{9}|15[89]\\d{8}|189\\d{8}$'}
		,{text:'固定电话',value:'^((\\d{3}|\\d{4})-?)?(\\d{8}|\\d{7})$'}
		,{text:'邮政编码',value:'^[1-9]{1}(\\d+){5}$'}
		,{text:'URL',value:'http:\/\/([\\w-]+\\.)+[\\w-]+(\/\\[\\w- .\/?%&=\\]*)?'}
		,{text:'IP地址',value:'^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$'}
		,{text:'数字',value:'^[+|-]?\\d*\\.?\\d*$'}
		,{text:'正整数',value:'^[1-9]\\d*$'}
		,{text:'负整数',value:'^-[1-9]\\d*$'}
		,{text:'任意整数',value:'^-?[1-9]\\d*$'}
		,{text:'正浮点数',value:'^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$'}
		,{text:'负浮点数',value:'^-([1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*)$'}
		,{text:'任意浮点数',value:'^-?([1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*|0?\\.0+|0)$'}
		,{text:'英文字母',value:'^[A-Za-z]+$'}
		,{text:'小写英文字母',value:'^[a-z]+$'}
		,{text:'大写英文字母',value:'^[A-Z]+$'}
	],function (){var O=$('#exps1').options;O[O.length]=new Option(this.text,this.value)});
	ldh.each([
		{text:'img标签',value:'<img[^>]+>'	}
		,{text:'链接',value:'<a[^>]+>(.*?)<\\/a>'}
		,{text:'图片地址',value:'(s|S)(r|R)(c|C) *= *(\\\'|\\\")?(\\w|\\\\|\\/|\\.|:)+(\\4)'}
		,{text:'链接地址',value:'href=(\\"|\\\'|)([^\\"\\\'<>]+)(\\1)'}
		,{text:'中文字符',value:'[\\u4e00-\\u9fa5]'}
		,{text:'双字节字符',value:'[^\\x00-\\xff]'}
		,{text:'文件名',value:'([^\\\/]*?)(?:\\.\\w+)$'}
	],function (){var O=$('#exps2').options;O[O.length]=new Option(this.text,this.value)});
	ldh.each([
		{text:'空行',value:'\\n[\\s| ]*\\r'}
		,{text:'HTML标签',value:'<[^>]+>'}
		,{text:'首尾空格',value:'(^\\s*)|(\\s*$)'}
	],function (){var O=$('#exps3').options;O[O.length]=new Option(this.text,this.value)});
	if(!document.all)$('#doNext').disabled=true;
	ldh.drag(ldh.find('#caption'),{win:ldh.find('#win'),left:0,top:0});
})()
</script>
</body>
</html>]]></WebRegExp><cssBevel author="" date="" common="css斜角"><![CDATA[<style type="text/css">
    span {
            width: 0px;
            height: 0px;
    }

    span.left {
            border-left: 90px solid white;
            border-bottom: 160px solid red;
    }

    span.right {
            border-right: 90px solid white;
            border-bottom: 160px solid red;
    }
</style>
<div align="center">
   <span class="left"></span>
   <span class="right"></span>
</div>]]></cssBevel><currying author="Winter" date="" common="javascript的functional特性实现:currying"><![CDATA[<script type="text/javascript">
/*
currying函数：接受一个函数类型参数f，返回currying化的f
currying化的函数即当函数参数个数不足时，返回接受剩余参数的函数。
*/
function currying(func)
{
    return function()
    {
        if(arguments.length<func.length)
        {
            var args=arguments;
            var retarg=new Array(func.length-arguments.length);
            for(var i=0;i<retarg.length;i++)retarg[i]="_"+i;
            eval("var ret=function("+retarg+"){return args.callee.apply(this,Array.prototype.slice.call(args).concat(Array.prototype.slice.call(arguments)));}");
            return currying(ret);
        }
	else return func.apply(this,arguments);
    }
}
/////////////////////////////////////////////////////////////////////////////////////////
function f(a,b,c)
{
    alert([a,b,c]);
}
var cuf=currying(f);
cuf(1)(2)(3);
cuf(1,2)(3);
</script>]]></currying><currying author="WC" date="" common=""><![CDATA[<script type="text/ecmascript">
function currying(func) {
    return function () {
		var root = this, args = arguments, sourceFunc = args.callee;
        if (args.length < func.length) {
			return function () {
				return sourceFunc.apply(
					root
					, Array.prototype.slice.call(args).concat(
						Array.prototype.slice.call(arguments)
					)
				);
			};
        } else return func.apply(this, args);
    };
}
/////////////////////////////////////////////////////////////////////////////////////////
var f = function (a, b, c) {
    alert([a, b, c]);
}
var cuf = currying(f);
cuf(1)(2)(3);
cuf(1, 2)(3);
cuf(1, 2, 3);
</script>]]></currying><currying author="月MM" date="" common=""><![CDATA[<script type="text/javascript">
function currying(func){

    return function(){
        var args = Array.prototype.slice.call(arguments,0);   

        if(args.length<func.length){                     
	return function(){
                         var _args = args.concat(Array.prototype.slice.call(arguments,0));   

                         return currying(func).apply(this,_args);
                }
        }
        else return func.apply(this,args);
    }
}
/////////////////////////////////////////////////////////////////////////////////////////
function f(a,b,c)
{
    alert([a,b,c]);
}
var cuf=currying(f);
cuf(1)(2)(3);
cuf(1,2)(3);
</script>]]></currying><getlen author="gsh945" date="2009-06-05" common="获取字符串的字节数"><![CDATA[<script type="text/javascript">
function getlen(s) 
{ 
var l = 0; 
var a = s.split(""); 
for (var i=0;i<a.length;i++) { 
if (a[i].charCodeAt(0)<299) { 
l++; 
} else { 
l+=2; 
} 
} 
return l; 
} 
document.write(getlen('aaa')+'<br/>');
document.write(getlen('aaa你好'));
</script>]]></getlen><getlen author="gsh945" date="2009-06-05" common="计算字符串实际字节数"><![CDATA[<script>
String.prototype.Length     = getlen;
function getlen()
{
  return this.replace(/[^\x00-\xff]/g,"**").length;
}
</script>
<input><input type="button" name="btn_click" value="Click Me!!" onclick="alert(parentNode.childNodes[0].value.Length())">]]></getlen><getEvent author="Q" date="2009-06-09" common="得到事件"><![CDATA[function getEvent(e){
		e = e || window.event;
		if(!e){
			var c = arguments.callee.caller;
			while(c){
				e = c.arguments[0];
				if(e && e.constructor == Event){
					break;
				}
				c = c.caller;
			}
		}
		return e;
	}]]></getEvent><JSON author="dh20156" date="" common="对象转换为JSON字符串"><![CDATA[<script type="text/javascript">

var toJSON = function(obj){
    var objco = (obj.constructor==Object),objca = (obj.constructor==Array),ret = [],sobj = null,acfoo = arguments.callee;
    if(!objco&&!objca){return obj.toString();}
    var toString = function(cobj,ot){
        if(!cobj){
            cobj = cobj===undefined?'undefined':(cobj===null?'null':(cobj===false?'false':(cobj===0?'0':(cobj===''?'\'\'':'NaN'))));
            if(ot){ret.push(d+':'+cobj)}else{ret.push(cobj);};return;
        }
        switch(cobj.constructor){
            case Array:
            case Object:if(ot){ret.push(d+':'+acfoo(cobj))}else{ret.push(acfoo(cobj))};break;
            case String:if(ot){ret.push(d+':\''+cobj.toString()+'\'')}else{ret.push('\''+cobj.toString()+'\'')};break;
            default:if(ot){ret.push(d+':'+cobj.toString())}else{ret.push(cobj.toString())};
        }
    };
    if(objco){for(var d in obj){sobj = obj[d];toString(sobj,true);}}
    if(objca){for(var i=0;i<obj.length;i++){sobj = obj[i];toString(sobj,false);}}
    obj = null;sobj = null;acfoo = null;
    return (objco)?'{'+ret.toString()+'}':(objca)?'['+ret.toString()+']':obj.toString();
};

var a = [0,1,2,3,{a:1},2,1,5,4,null,undefined,6,false,4,2,null,NaN,NaN,null,['a','c'],{a:1},function(){},100];
var sa = toJSON(a);

var b = {a:1,b:0,c:false,d:null,e:undefined,f:NaN,g:''};
var sb = toJSON(b);

alert(sa);
alert(sb);


var c = {a:[1,function(){},{f:0}],b:{c:2},d:3,e:function(){alert('e');}};

var d = [[1,function(){},{f:0}],{c:2},3,function(){alert('e');}];

alert(toJSON(c));

alert(toJSON(d));

alert(toJSON(true));

alert(toJSON(/test/ig));

alert(toJSON(20156));

alert(toJSON(new Date()));

</script>]]></JSON><cssCircularBead author="" date="" common="moz圆角"><![CDATA[<style type="text/css">
#x{width:400px;height:300px;background:#000;color:red;-moz-border-radius-bottomleft:10px;-moz-border-radius-bottomright:10px;-moz-border-radius-topleft:10px;-moz-border-radius-topright:10px;}
</style>

<div id="x"><h1>MOZ CSS圆角好帅 - -!</h1></div>]]></cssCircularBead><cssCircularBead author="" date="" common="webkit圆角阴影"><![CDATA[<style type="text/css">
div{
	width:200px;
	padding:5px;
	border:5px solid #CCC;
	-webkit-box-shadow:3px 3px 5px #333;
	-webkit-border-radius:5px;
}
</style>

<div>webkit圆角阴影效果，帅哦 - -!</div>]]></cssCircularBead><addEventListener author="dh20156" date="" common="给DOM节点或组绑定事件"><![CDATA[<fieldset>
<legend>bindEvent for single DOM Obect</legend>
<div id="x" style="width:100px;height:25px;line-height:25px;background:#212121;color:#fff;text-align:center;cursor:pointer;">div x</div>
</fieldset>

<fieldset>
<legend>bindEvent for [object HTMLCollection]</legend>
<button>button 1</button>
<button>button 2</button>
</fieldset>

<script type="text/javascript">
var dx = document.getElementById('x');
var dbtns = document.getElementsByTagName('button');

var easyDomEvent = function(){
    var swin = (this==window),stag = this.tagName,il = this.length;
    if(!swin&&!stag&&!il){return;}
    if(!swin&&il){for(var i=0;i<il;i++){arguments.callee.call(this[i]);}}
    this.eventList = {};
    this.bindEvent = function(sEvent,sFoo,cpt){
        if(!swin&&il){for(var i=0;i<il;i++){var di = this[i];di.bindEvent(sEvent,sFoo,cpt);}return;}
        var ael = this.eventList;if(!ael[sEvent]){ael[sEvent] = [];}
        var aels = ael[sEvent];for(var n=0;n<aels.length;n++){if(aels[n]==sFoo){return;}};aels.push(sFoo);
        if(document.attachEvent){this.attachEvent('on'+sEvent,sFoo);}else{this.addEventListener(sEvent,sFoo,cpt);}
    };
    this.removeEvent = function(sEvent,sFoo,cpt){
        if(!swin&&!stag&&il){for(var i=0;i<il;i++){var di = this[i];di.removeEvent(sEvent,sFoo,cpt);}return;}
        var aels = this.eventList[sEvent];for(var n=0;n<aels.length;n++){if(aels[n]==sFoo){aels.splice(n,1);break;}}
        if(document.attachEvent){this.detachEvent ('on'+sEvent,sFoo);}else{this.removeEventListener(sEvent,sFoo,cpt);}
    };
    var cleanup = function(){
        var ael = this.eventList;for(var evt in ael){this['on'+evt] = null;};
        this.eventList = null;this.bindEvent = null;this.removeEvent = null;
        if(document.attachEvent){window.detachEvent('onunload',cleanup);}else{window.removeEventListener('unload',cleanup,false);}
    };
    (function(){
        if(document.attachEvent){window.attachEvent('onunload',cleanup);}else{window.addEventListener('unload',cleanup,false);}
    })();
};

var f0 = function(){alert(0);};
var f1 = function(e){e=e||window.event;alert((e.srcElement||e.target).eventList['click']);};
var f2 = function(){alert(2);};

easyDomEvent.call(dx);
dx.bindEvent('click',f0);
dx.bindEvent('click',f1);
dx.bindEvent('click',f2);


easyDomEvent.call(dbtns);
dbtns.bindEvent('click',function(){alert(1);});
dbtns.bindEvent('click',f2);
dbtns.bindEvent('click',f1);
dbtns.bindEvent('click',f2);
dbtns.removeEvent('click',f2);
</script>]]></addEventListener><Tetris author="dh20156" date="" common="俄罗斯方块"><![CDATA[<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="UTF-8" />
<title>Easy Tetris JavaScript俄罗斯方块 - P 暂停, F2 新游戏, F4 开启投影, 空格 直接坠落,上箭头 变形, 左右箭头 左右移动, 下箭头 快速下落</title>
<meta name="robots" content="all" />
<meta name="author" content="dh20156@126.com,风之石" />
<meta name="Copyright" content="dh20156风之石" />
<style type="text/css">
.tetris{width:460px;overflow:hidden;background:#333;}
.tetris td{font-size:12px;width:16px;height:16px;}
.tetris td.borderbox{background:#525252 url(http://www.v-ec.com/games/tetris/images/box.png) -112px 0 no-repeat;}
.tetris .hd{width:100px;float:right;}
</style>
</head>
<body>
<div class="tetris" id="ga"><div class="hd"></div><div class="bd">游戏区域</div></div>
</body>
<script type="text/javascript">
var easyTT = function(){
	this.dinfo = null;//游戏信息区域
	this.dplayarea = null;//游戏区域
	this.dnext = null;//下一块提示
	this.showbox = null;//填色表格
	this.dplaybox = null;//调皮的方块
	this.dshadow = null;//阴影
}
easyTT.prototype = function(){
	//形状顺序：O,I,T,L,J,Z,S
	var shape = [[0x6600,0x6600,0x6600,0x6600],[0xf000,0x4444,0xf000,0x4444],[0xe400,0x4c40,0x4e00,0x8c80],[0xe800,0xc440,0x2e00,0x88c0],[0xe200,0x44c0,0x8e00,0xc880],[0xc600,0x2640,0xc600,0x2640],[0x6c00,0x4620,0x6c00,0x4620]];
	var shadow = [[0x68,0x68,0x68,0x68],[0xf8,0x48,0xf8,0x48],[0xe8,0xcc,0xec,0xcc],[0xe8,0xc8,0xec,0xce],[0xe8,0xce,0xec,0xc8],[0xec,0x6c,0xec,0x6c],[0xec,0x6c,0xec,0x6c]];
	var bgurl = 'http://www.v-ec.com/games/tetris/images/box.png';
	var colors = ['#D64A4A url('+bgurl+') 0 0 no-repeat','#BB51D4 url('+bgurl+') -16px 0 no-repeat','#EFCE52 url('+bgurl+') -32px 0 no-repeat','#9BBB49 url('+bgurl+') -48px 0 no-repeat','#41B341 url('+bgurl+') -64px 0 no-repeat','#10BDDE url('+bgurl+') -80px 0 no-repeat','#4A7BEF url('+bgurl+') -96px 0 no-repeat'];
	var grid = function(x,y,othstr){//表格类
		x = x||1;y = y||1;
		var str = '<tr>'+new Array(x+1).join('<td>&nbsp;</td>')+'</tr>';
		var stb = '<table cellpadding="0" cellspacing="1" style="border-collapse:separate;border-spacing:1px;">'+new Array(y+1).join(str)+'</table>';
		this.innerHTML = stb+(othstr||'');
        	this.data = new Array(y);
        	for(var i=0;i<y;i++){this.data[i] = new Array(x+1).join(0).split('');}
	};
	var oshadow = function(shapeindex,subindex){
		if(isNaN(shapeindex)||isNaN(subindex)){return;}
		var sshape = shadow[shapeindex][subindex];
		var drow = this.childNodes[0].rows[0],bm = sshape.toString(2),aspt = (new Array(9-bm.length).join(0)+bm).match(/\d{4}/g);
		var martix = aspt[0].split(''),py = aspt[1].match(/1/g).length|0;
		for(var i=0;i<4;i++){
			drow.cells[i].style.cssText = (parseInt(martix[i],10))?'background:#fff;height:1000px;':'background:none;height:1000px;';
		}
		this.py = py?py-1:0;
	};
	var diamond = function(shapeindex,subindex,colorindex){//方块类
		if(isNaN(shapeindex)||isNaN(subindex)||isNaN(colorindex)){return;}
		this.shapeindex = shapeindex,this.subindex = subindex,this.colorindex = colorindex;
		var sshape = shape[shapeindex][subindex],scolor = colors[colorindex];
		var asm = null,drows = this.childNodes[0].rows,ddata = this.data,crow = null,idx = 0,bm = sshape.toString(2),abm = new Array(17-bm.length).join(0)+bm,martix = abm.match(/\d{4}/g);
		while(martix.length){
			asm = martix.shift().split(''),crow = drows[idx],cdata = ddata[idx],idx++;
			for(var i=0;i<asm.length;i++){
				cdata[i] = asm[i];
				crow.cells[i].style.cssText = (parseInt(asm[i],10))?'background:'+scolor:'background:none;';
			}
		}
	};
	var nextbox = function(){//下一个方块
		this.next = function(){
			var lshape = shape.length-1,lcolor = colors.length-1;
			var rndshape = Math.round(Math.random()*lshape);
			var rndcolor = Math.round(Math.random()*lcolor);
			this.style.disply = 'none';
			diamond.call(this,rndshape,0,rndcolor);
			this.style.display = 'block';
		};
	};
	var stopEvent = function(e){
		e = e||window.event;
		if(e.stopPropagation){e.stopPropagation();}else{e.cancelBubble = true;}
		if(e.preventDefault){e.preventDefault();}else{e.returnValue = false;e.keyCode = 0;}
	};
	var playbox = function(){//掉落方块类
		var lscore = [100,200,400,800];//消除方块得分列表
		var levellist = [0,2000,4000,6000,8000,10000,12000,14000,16000,18000,20000];//级别分数设定
		var level = 1;//当前级别
		var score = 0;//当前得分
		var speed = 1000;//初始速度
		this.timer = null;
		this.speed = function(){return speed/level|0;};
		this.style.position = 'absolute';
		this.style.zIndex = "10";
		this.style.display = "none";
		this.dnext = null;//下一块提示
		this.dinfo = null;//游戏信息
		this.dshadow = null;//投影
		this.pause = true;//暂停
		this.shadowon = false;//是否启用投影
		this.useshadow = function(){
			if(this.dshadow){this.dshadow.style.display = (this.shadowon)?'none':'block';this.shadowon = (this.shadowon)?false:true;}
		};
		this.over = function(){//游戏结束
			window.clearTimeout(this.timer);
			if(confirm('游戏结束！\n\n再来一局？ ^_^')){this.newgame();}
		};
		this.newgame = function(){//新游戏
			var pdata = this.parentNode.childNodes[0].data,drows = this.parentNode.childNodes[1].childNodes[0].rows;
			for(var i=23;i>=4;i--){
				for(var m=0;m<20;m++){
					if(m>=4&&m<=15){
						pdata[i][m] = 0;
						drows[i].cells[m].style.background = 'none';
					}
				}
			}
			this.pause = false;
			this.play();
		};
		this.play = function(){//开始
			if(!this.dnext){return false;}
			var dnext = this.dnext,dshadow = this.dshadow;
			var shapeindex = dnext.shapeindex,colorindex = dnext.colorindex;
			this.style.display = 'none';
			diamond.call(this,shapeindex,0,colorindex);
			this.x = 8;
			this.y = 4;
			this.transindex = 0;
			this.move(this.x,this.y);
			this.style.display = 'block';
			dshadow.style.display = 'none';
			oshadow.call(dshadow,shapeindex,0);
			var pspy = 4+dshadow.py|0,psy = pspy+pspy*16;
			dshadow.style.top = psy+'px';
			if(this.shadowon){dshadow.style.display = 'block';}
			this.timer = window.setTimeout((function(o){return function(){o.down()}})(this),this.speed());
			dnext.next();
		};
		this.check = function(s,x,y){//边界检测
			var pd = this.parentNode.childNodes[0].data,dpd = [],bm = shape[this.shapeindex][s].toString(2),bdt = new Array(17-bm.length).join(0)+bm;
			dpd.push(pd[y].slice(x,x+4).join(''));
			dpd.push(pd[y+1].slice(x,x+4).join(''));
			dpd.push(pd[y+2].slice(x,x+4).join(''));
			dpd.push(pd[y+3].slice(x,x+4).join(''));
			var dbdt = parseInt(bdt,2),dpdt = parseInt(dpd.join(''),2),bnext = !(dbdt&dpdt);
			//alert(x+','+y+','+bdt+','+dpd.join('')+','+bnext);
			if(!bnext){return false;}
			return true;
		};
		this.move = function(x,y){//移动
			if(this.pause){return true;}
			var bnext = this.check(this.subindex,x,y),dshadow = this.dshadow;
			if(!bnext){return false;}
			this.x = x,this.y = y;
			var px = x+x*16,py = y+y*16,pspy = y+dshadow.py|0,psy = pspy+pspy*16;
			this.style.left = px+'px';
			this.style.top = py+'px';
			dshadow.style.left = px+'px';
			dshadow.style.top = psy+'px';
			return true;
		};
		this.down = function(){//飘落
			if(this.pause){return;}
			var bnext = this.move(this.x,this.y+1);
			if(!bnext){
				window.clearTimeout(this.timer);
				bnext = this.actiondown();
				if(!bnext){return;}
				this.play();
				return;
			}
			this.timer = window.setTimeout((function(o){return function(){o.down()}})(this),this.speed());
		};
		this.ddown = function(){//坠落
			if(this.pause){return;}
			var bnext = this.move(this.x,this.y+1);
			if(!bnext){
				window.clearTimeout(this.timer);
				bnext = this.actiondown();
				if(!bnext){return;}
				this.play();
				return;
			}
			if(/msie/i.test(navigator.appVersion)){this.timer = window.setTimeout((function(o){return function(){o.ddown()}})(this),0);}else{this.ddown();}
		};
		this.actiondown = function(){//落地检测
			this.style.display = 'none';
			if(this.useshadow){this.dshadow.style.display = 'none';}
			var x = this.x,y = this.y,l = 0,pdata = this.parentNode.childNodes[0].data,dtb = this.parentNode.childNodes[1].childNodes[0],drows = dtb.rows,fx = 0,fy = 0,scolor = colors[this.colorindex];
			for(var i=0;i<4;i++){
				for(var n=0;n<4;n++){
					fy = y+i,fx = x+n;
					if(this.data[i][n]==1){pdata[fy][fx] = 1;drows[fy].cells[fx].style.background = scolor;}
				}
			}
			for(i=pdata.length-5;i>=y;i--){
				if(eval('0,'+pdata[i].join('&&'))){
					pdata.splice(i,1);
					pdata.splice(4,0,[1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1]);
					dtb.deleteRow(i);
					var dcr = drows[0].cloneNode(true);
					dtb.childNodes[0].insertBefore(dcr,drows[0]);
					i++;l++;
				}
			}
			if(l){
				score += lscore[l-1];
				if(score>levellist[level]){level++;}
				if(this.dinfo){this.dinfo.innerHTML = '<p>级别：</p><p>'+level+'</p><p>得分：</p><p>'+score+'</p>';}
			}
			if(!l&&y<=4){this.over();return false;}
			return true;
		};
		this.transform = function(){//变形
			if(this.pause){return true;}
			var sindex = this.shapeindex,tindex = this.subindex,cindex = this.colorindex,dshadow = this.dshadow;
			if(tindex+1>3){tindex = 0;}else{tindex++;}
			var bnext = this.check(tindex,this.x,this.y);
			if(!bnext){return;}
			this.subindex = tindex;
			diamond.call(this,sindex,tindex,cindex);
			oshadow.call(dshadow,sindex,tindex);
			var pspy = this.y+dshadow.py|0,psy = pspy+pspy*16;
			dshadow.style.top = psy+'px';
		};
	};
	return {
		init:function(){//初始化
			if(!this.dinfo||!this.dplayarea){return;}
			var dinfo = this.dinfo,dplayarea = this.dplayarea;
			dinfo.innerHTML = '<div></div><div><p>级别：</p><p>1</p><p>得分：</p><p>0</p></div>';
			var dnext = dinfo.childNodes[0];
			grid.call(dnext,4,4);
			nextbox.call(dnext);
			dnext.next();
			this.dnext = dnext;
			dplayarea.onselectstart = function(){return false;}
			dplayarea.innerHTML = '<div></div><div></div><div></div><div></div>';
			grid.call(dplayarea.childNodes[0],20,28);
			dplayarea.style.cssText = 'position:relative;-moz-user-select:none;overflow:hidden;zoom:1;width:'+(16*20+21)+'px;height:'+(16*28+29)+'px;';
			dplayarea.childNodes[0].style.cssText = 'position:absolute;z-index:3;left:0;top:0;';
			dplayarea.childNodes[0].childNodes[0].style.cssText = 'border-collapse:separate;border-spacing:1px;';
			var dpadata = dplayarea.childNodes[0].data,drows = dplayarea.childNodes[0].childNodes[0].childNodes[0].rows;
			for(var i=0;i<28;i++){
				if(i>=4&&i<=23){
					for(var m=0;m<20;m++){
						if(m>=4&&m<=15){continue;}
						dpadata[i][m] = 1;
						drows[i].cells[m].className = 'borderbox';
					}
				}else{
					for(var n=0;n<20;n++){
						dpadata[i][n] = 1;
						drows[i].cells[n].className = 'borderbox';
					}
				}
			}
			var dshowbox = dplayarea.childNodes[1];
			dshowbox.style.cssText = 'position:absolute;left:0;top:0;z-index:5;';
			grid.call(dshowbox,20,28);
			this.dshowbox = dshowbox;
			var dshadow = dplayarea.childNodes[2];
			grid.call(dshadow,4,1);
			dshadow.style.cssText = 'position:absolute;left:0;top:0;z-index:1;-moz-opacity:0.1;opacity:0.1;filter:alpha(opacity=10);';
			this.dshadow = dshadow;
			var dplaybox = dplayarea.childNodes[3];
			grid.call(dplaybox,4,4);
			playbox.call(dplaybox);
			dplaybox.dnext = dnext;
			dplaybox.dshadow = dshadow;
			dplaybox.dinfo = dinfo.childNodes[1];
			dplaybox.dinfo.style.color = '#fff';
			this.dplaybox = dplaybox;
			document.documentElement.onkeydown = function(e){
				e = e||window.event;
				var ec = e.which||e.keyCode;
				switch(ec){
					case 37:dplaybox.move(dplaybox.x-1,dplaybox.y);stopEvent(e);break;
					case 39:dplaybox.move(dplaybox.x+1,dplaybox.y);stopEvent(e);break;
					case 38:dplaybox.transform();stopEvent(e);break;
					case 32:window.clearTimeout(dplaybox.timer);dplaybox.ddown();stopEvent(e);break;
					case 40:window.clearTimeout(dplaybox.timer);dplaybox.down();stopEvent(e);break;
					case 80:if(dplaybox.pause){dplaybox.pause = false;dplaybox.down();}else{dplaybox.pause = true;window.clearTimeout(dplaybox.timer);};stopEvent(e);break;
					case 113:if(confirm('要开始新的游戏吗？ ^_^')){dplaybox.newgame();}stopEvent(e);break;
					case 115:dplaybox.useshadow();stopEvent(e);break;
					default:break;
				}
			};
		},
		start:function(){//开始
			this.dplaybox.newgame();
		}
	};
}();

var da  = document.getElementById('ga'),dads = da.childNodes;
var dinfo = dads[0],darea = dads[1];
var gtt = new easyTT();
gtt.dinfo = dinfo;
gtt.dplayarea = darea;
gtt.init();
</script>
</html>]]></Tetris><GetObject author="Craze" date="2009-6-22" common="Get Object"><![CDATA[var $=(function(){
	function getObj(obj){
		if(document.getElementById){/*是公共标准，被目前的所有主流浏览器支持*/
			return eval('document.getElementById("'+obj+'")')
		}else if(document.layers){/*Netscape 4.x专有的属性*/
			return eval("document.layers['"+obj+"']")
		}else{/*只有IE支持。document.all是IE 4.0及以上版本的专有属性*/
			return eval('document.all.'+obj)
		}
	};
	function $(){
		var objElements = new Array();
		for(var i=0;i<arguments.length;i++){
			var objEle=arguments[i];
			if(typeof arguments[i]=='string'){
				objEle=getObj(arguments[i])
			}
			objElements.push(objEle)
		}
		if(arguments.length==1){
			return objEle
		}else{
			return objElements
		}
	};
	return $;
})()]]></GetObject><NoDpmPrintString author="51jser" date="" common="代码中不出现引号如何alert出字符"><![CDATA[<pre>
编码环境:
&lt;script&gt;
[代码]
&lt;script&gt;
环境要求:
[代码]中不能出现引号(包括单引号和双引号).
功能要求: 实现弹出框对话框,对话框内容:"你好".
</pre>

<script>
//正则对象
alert(/你好/.source);
alert(/你好/.toString().slice(1,-1));

//遍历对象
var o = {你好:null};
for(var i in o){alert(i);}

//字符集
alert(String.fromCharCode(20320, 22909));

//function
var f = function(){var 你好 = /%/;return 你好;}.toString();
var s = f.match(/var (\S+)/)[1];
alert(s.length == 2 ? s : unescape(s.replace(/\\/g, f.match(/%/)[0])));
</script>]]></NoDpmPrintString><CharacterEncoding author="ha.ckers.org" date="" common="字符的一些转换"><![CDATA[<center><h2><A NAME="XSScalc">Character Encoding Calculator</A></h2></center>

<FORM NAME="XSS" ACTION="">
<b>ASCII Text:</b>

            <UL> 
<TEXTAREA name="ascii" COLS=45 ROWS=3>Enter your XSS here</TEXTAREA><BR><input type="button" value="Encode" onclick="encode()">
<input type="reset" value="Clear">
            </UL>
<b>Hex Value:</b>
            <UL> 
URL:<BR>

<input type="text" name="hex" size="60"><BR><input type="button" value="Decode Hex to ASCII" onclick="decode()" size="50"><BR>
HTML (with semicolons):<BR>
<input type="text" name="hexhtml" size="60"><BR><input type="button" value="Decode Hex Entities to ASCII" onclick="convertHexToASCII()" size="50"><BR>
            </UL>

<b>Decimal Value:</b>
            <UL> 
HTML (without semicolons):<BR>
<input type="text" name="unicode" size="60"><BR>
<input type="button" value="Decode Dec to ASCII" onclick="convertToASCII()">
            </UL>

<b>Base64 Value</b> (<A HREF="http://ostermiller.org/calc/encode.html">a more robust base64 calculator can be found here</A>)
            <UL> 
Base64:<BR>
<input type="text" name="base64" size="60"><BR>
<input type="button" value="Decode Base64" onclick="document.XSS.ascii.value=decodeBase64(document.XSS.base64.value);">
            </UL>
</FORM>
<BR><BR>
<DIV ALIGN="CENTER"><H2><A NAME="ipobfuscate">IP Obfuscation Calculator</A></H2></DIV>

<FORM NAME="IP" ACTION="">
<b>IP Address:</b>

            <UL> 
<input type="text" name="ip" size="30" value="127.0.0.1"><input type="text" size=1 name="level" value="0"> : dword level
<BR><input type="button" value="Encode" onclick="convet(ip.value,level.value);">
<input type="reset" value="Clear">
            </UL>

<b>Dword Address:</b>
            <UL>

<input type="text" name="ipdword" size="30">
            </UL>

<b>Hex Address:</b>
            <UL>
<input type="text" name="iphex" size="30">
            </UL>

<b>Octal Address:</b>
            <UL>
<input type="text" name="ipoctal" size="30">

            </UL>
          </FORM>
<BR><BR>


<script type="text/javascript">
function decode(){ 
  if(document.XSS.hex.value != ''){ 
    var vText = document.XSS.hex.value; 
    document.XSS.ascii.value = unescape(vText); 
  } 
} 

function encode(){ 
  if(document.XSS.ascii.value != ''){ 
    var vText = document.XSS.ascii.value; 
    document.XSS.hex.value = convertToHex(vText); 
    document.XSS.hexhtml.value = convertToHexHTML(vText); 
    var vEncoded = convertToUnicode(vText); 
    document.XSS.unicode.value = vEncoded; 
    document.XSS.ascii.focus();
    document.XSS.ascii.blur();
    document.XSS.ascii.select();
    document.XSS.base64.value=encodeBase64(document.XSS.ascii.value);
  } 
} 

function convertToUnicode(source) { 
  result = ''; 
  for (i=0; i<source.length; i++) {
    result += '&#' + source.charCodeAt(i); 
  }
  return result; 
} 

function convertToHex(num) { 
  var hex = ''; 
  for (i=0;i<num.length;i++) {
    if (num.charCodeAt(i).toString(16).toUpperCase().length < 2) {
      hex += "%0" + num.charCodeAt(i).toString(16).toUpperCase(); 
    } else {
      hex += "%" + num.charCodeAt(i).toString(16).toUpperCase(); 
    }
  }
  return hex; 
} 

function convertToHexHTML(num) { 
  var hexhtml = ''; 
  for (i=0;i<num.length;i++) {
    if (num.charCodeAt(i).toString(16).toUpperCase().length < 2) {
      hexhtml += "&#x0" + num.charCodeAt(i).toString(16).toUpperCase() + ";"; 
    } else {
      hexhtml += "&#x" + num.charCodeAt(i).toString(16).toUpperCase() + ";"; 
    }
  }
  return hexhtml; 
} 

function convertToASCII() {
  if (document.XSS.unicode.value != '') {
    var uniText = document.XSS.unicode.value;
    var testText = uniText.substring(2,uniText.length).split("&#")
    var resultString = ""
    for (i=0;i<testText.length;i++) {
      if  (dec2hex(testText[i]).length < 2) {
        resultString += "%0" + dec2hex(testText[i])
      } else {
        resultString += "%" + dec2hex(testText[i])
      }
      document.XSS.ascii.value = unescape(resultString);
    }
  }
}

function convertHexToASCII() {
  if (document.XSS.hexhtml.value != '') {
    var hexText = document.XSS.hexhtml.value;
    var testText = hexText.substring(3,hexText.length).split("&#x");
    var resultString = '';
    var sub = '';
    for (i=0;i<testText.length;i++) {
      sub = testText[i].substring(testText[i].length-3,testText[i].length-1) 
      if  (sub.length < 2) {
        resultString += "%0" + sub;
        alert (sub, " - ", resultString);
      } else {
        resultString += "%" + sub;
      }
      document.XSS.ascii.value = unescape(resultString);
    }
  }
}

function dec2hex(n){
  var hex = "0123456789ABCDEF";
  var mask = 0xf;
  var retstr = "";
  while(n != 0){
    retstr = hex.charAt(n&mask) + retstr;
    n>>>=4;
  }
  return retstr.length == 0 ? "0" : retstr;
}

var base64Chars = new Array(
    'A','B','C','D','E','F','G','H',
    'I','J','K','L','M','N','O','P',
    'Q','R','S','T','U','V','W','X',
    'Y','Z','a','b','c','d','e','f',
    'g','h','i','j','k','l','m','n',
    'o','p','q','r','s','t','u','v',
    'w','x','y','z','0','1','2','3',
    '4','5','6','7','8','9','+','/'
);

var reverseBase64Chars = new Array();
for (var i=0; i < base64Chars.length; i++){
    reverseBase64Chars[base64Chars[i]] = i;
}

var base64Str;
var base64Count;
function setBase64Str(str){
    base64Str = str;
    base64Count = 0;
}
function readBase64(){    
    if (!base64Str) return -1;
    if (base64Count >= base64Str.length) return -1;
    var c = base64Str.charCodeAt(base64Count) & 0xff;
    base64Count++;
    return c;
}
function encodeBase64(str){
    setBase64Str(str);
    var result = '';
    var inBuffer = new Array(3);
    var lineCount = 0;
    var done = false;
    while (!done && (inBuffer[0] = readBase64()) != -1){
        inBuffer[1] = readBase64();
        inBuffer[2] = readBase64();
        result += (base64Chars[ inBuffer[0] >> 2 ]);
        if (inBuffer[1] != -1){
            result += (base64Chars [(( inBuffer[0] << 4 ) & 0x30) | (inBuffer[1] >> 4) ]);
            if (inBuffer[2] != -1){
                result += (base64Chars [((inBuffer[1] << 2) & 0x3c) | (inBuffer[2] >> 6) ]);
                result += (base64Chars [inBuffer[2] & 0x3F]);
            } else {
                result += (base64Chars [((inBuffer[1] << 2) & 0x3c)]);
                result += ('=');
                done = true;
            }
        } else {
            result += (base64Chars [(( inBuffer[0] << 4 ) & 0x30)]);
            result += ('=');
            result += ('=');
            done = true;
        }
        lineCount += 4;
        if (lineCount >= 76){
            result += ('\n');
            lineCount = 0;
        }
    }
    return result;
}

function readReverseBase64(){   
    if (!base64Str) return -1;
    while (true){      
        if (base64Count >= base64Str.length) return -1;
        var nextCharacter = base64Str.charAt(base64Count);
        base64Count++;
        if (reverseBase64Chars[nextCharacter]){
            return reverseBase64Chars[nextCharacter];
        }
        if (nextCharacter == 'A') return 0;
    } 
}

function ntos(n){
    n=n.toString(16);
    if (n.length == 1) n="0"+n;
    n="%"+n;
    return unescape(n);
}

function decodeBase64(str){
    setBase64Str(str);
    var result = "";
    var inBuffer = new Array(4);
    var done = false;
    while (!done && (inBuffer[0] = readReverseBase64()) != -1
        && (inBuffer[1] = readReverseBase64()) != -1){
        inBuffer[2] = readReverseBase64();
        inBuffer[3] = readReverseBase64();
        result += ntos((((inBuffer[0] << 2) & 0xff)| inBuffer[1] >> 4));
        if (inBuffer[2] != -1){
            result +=  ntos((((inBuffer[1] << 4) & 0xff)| inBuffer[2] >> 2));
            if (inBuffer[3] != -1){
                result +=  ntos((((inBuffer[2] << 6)  & 0xff) | inBuffer[3]));
            } else {
                done = true;
            }
        } else {
            done = true;
        }
    }
    return result;
}

function convet(ip,level){
  if (level > 1) {
    alert("Dword level must be 0 or 1");
    document.IP.level.value = 0;
  }
  n=ip.split('.'); 
  for(i=0;i<4;i++) {
    n[i]=parseInt(n[i]);
  } 
  var dword=(n[0]*16777216)+(n[1]*65536)+(n[2]*256)+n[3]+(parseInt(level)*4294967296);
  document.IP.ipdword.value = dword;
  tooct(ip);
  tohex(ip);
} 

function tooct(a){ 
  n=a.split('.'); 
  for(i=0;i<4;i++) { 
    n[i]=parseInt(n[i]);
    if(n[i]>255||isNaN(n[i])){
      alert('invalid ip!');
      return;
    }
    var one=Math.floor(n[i]/64); 
    var t=n[i]%64; 
    var two=Math.floor(t/8);
    var three=n[i]%8; 
    n[i]='0'+one+two+three; 
  } 
  var octip=n.join('.');
  if(octip.substring(octip.length-1,octip.length)=='.') {
    octip=octip.substring(0,octip.length-1);
  } 
  document.IP.ipoctal.value = octip;
  return;
} 

function tohex(ip){ 
  n=ip.split('.'); 
  for(i=0;i<4;i++) { 
    n[i]=parseInt(n[i]);
    if(n[i]>255||isNaN(n[i])){
      return;
    }
    var two=numlet(n[i]%16); 
    var one=numlet(Math.floor(n[i]/16));
    n[i]='0x'+one+two;
  } 
  var hexip=n.join('.');
  if(hexip.substring(hexip.length-1,hexip.length)=='.') {
    hexip=hexip.substring(0,hexip.length-1);
  } 
  document.IP.iphex.value = hexip;
  return; 
}

function numlet(num){ 
  if(num==10){return 'a';} 
  if(num==11){return 'b';}
  if(num==12){return 'c';} 
  if(num==13){return 'd';} 
  if(num==14){return 'e';}
  if(num==15){return 'f';} 
  return num;
} 
</script>]]></CharacterEncoding><cssSelector author="dh20156" date="" common="css选择器"><![CDATA[<style type="text/css">
span[data="span D data"]{color:#f00;}
div>div>div>p+p+p span+span{color:#f00;}
div>div>div+p>span:first-child{color:#f00;}
</style>

<div>First DIV
 <p>Paragraph One -
  <span>A</span>
  <span>B</span>
 </p>
 <div>Second DIV
  <p>Paragraph Two -
   <span>C</span>
   <span data="span D data">D</span>
  </p>
  <p>Paragraph Three -
   <span>E</span>
   <span>F</span>
  </p>
  <p>Paragraph Four -
   <span>G</span>
   <span>H</span>
  </p>
  <div>Third DIV
   <p>Paragraph Five -
    <span>I</span>
    <span>J</span>
   </p>
   <p>Paragraph Six -
    <span>K</span>
    <span>L</span>
   </p>
   <p>Paragraph Seven -
    <span>M</span>
    <span>N</span>
   </p>
  </div>
  <p>Paragraph Eight -
   <span>O</span>
   <span>P</span>
  </p>
 </div>
 <p>Paragraph Nine -
  <span>Q</span>
  <span>R</span>
 </P>
</div>

<script type="text/javascript" src="http://www.easyui.org.cn/easyui.js"></script>
<script type="text/javascript" defer="defer">
window.onload = function(){
var dElements = easyUI.cssSelector('span[data="span D data"],div>div>div>p+p+p span+span,div>div>div+p>span:first-child');
for(var i=0;i<dElements.length;i++){
    alert(dElements[i].innerHTML);
}};
</script>]]></cssSelector><easySort author="dh20156" date="" common=""><![CDATA[<script type="text/javascript">

var easySort = function(list){
    var s = new Date();
    var l = list.length,v = null,b = [];
    for(var i=0;i<l;i++){
        v = list[i];
        if(!b[v]){b[v] = [];}
        b[v].push(v);
    }
    return b.join(',').replace(/^,*/,'').split(/,+/)+'<br>'+(new Date()-s+'ms');
}

var createList = function(n){
    var a = [];
    for(var i=0;i<n;i++){a[i] = Math.random()*n|1;}
    return a.slice(0);
};

var a = createList(100000);

document.write('<h1>EasySort</h1>');
var b = easySort(a);
document.write(b+'<hr/>');

document.write('<h1>sort</h1>');
var s = new Date();
var c = a.sort(function(a,b){return a-b;})+'<br>'+(new Date()-s)+'ms';
document.write(c);

</script>]]></easySort><NineSixty author="dh20156" date="" common="960GridSystem页面布局"><![CDATA[<!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd">
<html>
<head>
<style type="text/css">
/* reset */
html{color:#666;background:#FFF;}
body{text-align:center;font:13px/1.7 Verdana, Simsun, Arial, Helvetica, "Microsoft YaHei", Mingliu;}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}
table{border-collapse:collapse;border-spacing:0;table-layout:fixed;width:100%;}
img{border:none;}
li{list-style:none;}
img,object,textarea{vertical-align:top;}
input,select,button{vertical-align:middle;}
button{height:24px;*padding:0 3px;overflow:visible;}
caption,th{text-align:left;}
h1,h2,h3,h4,h5,h6,input,textarea,select,address,caption,cite,code,dfn,em,th,var,abbr,acronym{font-size:100%;font-style:normal;}
q:before,q:after{content:"";}
legend{color:#000;}
ins{text-decoration:none;}
div{padding:0;margin:0;zoom:1;}
div:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
/* common */
.page{margin:0 auto;text-align:left;}
.float_left{float:left;}
.float_right{float:right;}
.txt_left{text-align:left;}
.txt_center{text-align:center;}
.txt_right{text-align:right;}
.clear_both{clear:both;}
.module{margin:0 5px;margin-bottom:10px;padding:5px;border:1px solid #ccc;}
/* 960 grid 24 colums */
.grid_1{width:40px;}
.grid_2{width:80px;}
.grid_3{width:120px;}
.grid_4{width:160px;}
.grid_5{width:200px;}
.grid_6{width:240px;}
.grid_7{width:280px;}
.grid_8{width:320px;}
.grid_9{width:360px;}
.grid_10{width:400px;}
.grid_11{width:440px;}
.grid_12{width:480px;}
.grid_13{width:520px;}
.grid_14{width:560px;}
.grid_15{width:600px;}
.grid_16{width:640px;}
.grid_17{width:680px;}
.grid_18{width:720px;}
.grid_19{width:760px;}
.grid_20{width:800px;}
.grid_21{width:840px;}
.grid_22{width:880px;}
.grid_23{width:920px;}
.grid_24{width:960px;}
</style>
</head>
<body>
<div id="hd">
	<div class="page grid_24">
		<div class="masthead module txt_right">
			<a href="http://www.v-ec.com">VEC</a>·<a href="http://www.w3cgroup.com">W3CGroup</a>·<a href="http://www.easyui.org.cn">EasyUI</a>·<a href="http://www.jslab.org.cn">JSLab</a>
		</div>
		<div class="logo module">
			<a href="http://www.v-ec.com"><img src="http://www.v-ec.com/ijc/vec_logo.png" alt="v-ec.com"></a>
		</div>
		<div class="search module txt_center">
			<form action="?">
				<label>grid_24</label>
				<input type="text" />
				<button type="submit">搜索</button>
			</form>
		</div>
	</div>
</div>
<div id="bd">
	<div class="page grid_24">
		<div class="grid_8 float_left">
			<div class="module">
				<p>grid_8</p>
			</div>
		</div>
		<div class="grid_16 float_left">
			<div class="grid_11 float_left">
				<div class="module"><p>grid_11</p></div>
			</div>
			<div class="grid_5 float_left">
				<div class="module"><p>grid_5</p></div>
			</div>
			<div class="grid_16 clear_both">
				<div class="module"><p>grid_16</p></div>
			</div>
		</div>
	</div>
	<div class="page grid_24">
		<div class="grid_8 float_left">
			<div class="module">
				<p>grid_8</p>
			</div>
		</div>
		<div class="grid_11 float_left">
			<div class="module">
				<p>grid_11</p>
			</div>
		</div>
		<div class="grid_5 float_left">
			<div class="module">
				<p>grid_5</p>
			</div>
		</div>
	</div>
	<div class="page grid_24">
		<div class="grid_19 float_left">
			<div class="module">
				<p>grid_19</p>
			</div>
		</div>
		<div class="grid_5 float_left">
			<div class="module">
				<p>grid_5</p>
			</div>
		</div>
	</div>
	<div class="page grid_24">
		<div class="grid_16 float_left">
			<div class="module">
				<p>grid_16</p>
			</div>
		</div>
		<div class="grid_8 float_left">
			<div class="module">
				<p>grid_8</p>
			</div>
		</div>
	</div>
	<div class="page grid_24">
		<div class="grid_8 float_left">
			<div class="module">
				<p>grid_8</p>
			</div>
		</div>
		<div class="grid_8 float_left">
			<div class="module">
				<p>grid_8</p>
			</div>
		</div>
		<div class="grid_8 float_left">
			<div class="module">
				<p>grid_8</p>
			</div>
		</div>
	</div>
	<div class="page grid_24">
		<div class="grid_8 float_left">
			<div class="module">
				<p>grid_8</p>
			</div>
		</div>
		<div class="grid_16 float_left">
			<div class="module">
				<p>grid_16</p>
			</div>
		</div>
	</div>
</div>
<div id="ft">
	<div class="page grid_24">
		<div class="module txt_center">
			<p>Copyright © 1998 - 2009 W3CGroup. All Rights Reserved</p>
		</div>
	</div>
</div>
</body>
</html>]]></NineSixty><NineSixty author="dh20156" date="" common="960布局系统原型"><![CDATA[<!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd">
<html>
<head>
<style type="text/css">
/* reset */
html{color:#666;background:#FFF;}
body{text-align:center;font:13px/1.7 Verdana, Simsun, Arial, Helvetica, "Microsoft YaHei", Mingliu;}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}
table{border-collapse:collapse;border-spacing:0;table-layout:fixed;width:100%;}
img{border:none;}
li{list-style:none;}
img,object,textarea{vertical-align:top;}
input,select,button{vertical-align:middle;}
button{height:24px;*padding:0 3px;overflow:visible;}
caption,th{text-align:left;}
h1,h2,h3,h4,h5,h6,input,textarea,select,address,caption,cite,code,dfn,em,th,var,abbr,acronym{font-size:100%;font-style:normal;}
q:before,q:after{content:"";}
legend{color:#000;}
ins{text-decoration:none;}
div{padding:0;margin:0;zoom:1;}
div:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
/* common */
.page{margin:0 auto;text-align:left;}
.float_left{float:left;}
.float_right{float:right;}
.txt_left{text-align:left;}
.txt_center{text-align:center;}
.txt_right{text-align:right;}
.clear_both{clear:both;}
.module{margin:0 5px;margin-bottom:10px;padding:5px;border:1px solid #ccc;}
/* layout config */
.layout{background:#ccc;margin-bottom:5px;zoom:1;overflow:hidden;}
.layout .layout{float:left;}
.layout .layout_cfg{text-align:right;margin:5px 5px 0;padding:5px;background:#666;color:#fff;}
.layout .layout_mod{margin:0 5px 5px;background:#eee;outline:none;cursor:text;}
/* 960 grid 24 colums */
.g1{width:40px;}
.g2{width:80px;}
.g3{width:120px;}
.g4{width:160px;}
.g5{width:200px;}
.g6{width:240px;}
.g7{width:280px;}
.g8{width:320px;}
.g9{width:360px;}
.g10{width:400px;}
.g11{width:440px;}
.g12{width:480px;}
.g13{width:520px;}
.g14{width:560px;}
.g15{width:600px;}
.g16{width:640px;}
.g17{width:680px;}
.g18{width:720px;}
.g19{width:760px;}
.g20{width:800px;}
.g21{width:840px;}
.g22{width:880px;}
.g23{width:920px;}
.g24{width:960px;}
</style>
</head>
<body>
<div id="hd">
	<div class="page layout g24" grid="24">
		masthead.php
	</div>
</div>
<div id="bd">
	<div class="page layout g24" grid="24">
		<div class="layout g18" grid="18">
			banner_ad.php
		</div>
		<div class="layout g6" grid="6">
			notice.php
		</div>
	</div>
	<div class="page layout g24" grid="24">
		about_us.php
	</div>
	<div class="page layout g24" grid="24">
		<div class="layout g8" grid="8">
			news_list_a.php
		</div>
		<div class="layout g10" grid="10">
			news_list_b.php
		</div>
		<div class="layout g6" grid="6">
			news_list_c.php
		</div>
	</div>
</div>
<div id="ft">
	<div class="page layout g24" grid="24">
		foot.php
	</div>
</div>
</body>
<script type="text/javascript">
var resetChildNodes = function(_elm){
	var _cn = _elm.childNodes,_nd = null;
	for(var i=0;i<_cn.length;i++){
		_nd = _cn[i];
		if(_nd.nodeType==3&&!(_nd.nodeValue.replace(/\s/g,''))){
			_elm.removeChild(_nd);
		}
	}
};
var flashBC = function(dNode){
	var times = 5,sbg = '#ccc',snbg = sbg;
	var change = function(){
		if(!times){dNode.style.background = sbg;return;}
		times--;
		snbg = (snbg==sbg)?'red':sbg;
		dNode.style.background = snbg;
		window.setTimeout(arguments.callee,100);
	};
	change();
};
var exchangeNode = function(nodeA,nodeB,idx){
	if(!nodeA||!nodeB){return;}
	var dparent = nodeB.parentNode;
	resetChildNodes(dparent);
	if(nodeB.swapNode){
		nodeB.swapNode(nodeA);
	}else{
		dparent.removeChild(nodeB);
		dparent.insertBefore(nodeB,nodeA);
	}
	flashBC(arguments[idx]);
};
var gridPanel = function(dGrid,bAT){
	if(!dGrid){return;}
	var hasGrids = dGrid.getElementsByTagName('div').length|0;
	var isCGrid = /\blayout\b/i.test(dGrid.parentNode.className);
	var sIH = dGrid.innerHTML,aRIH = [],sInsert = [];
	var scp = isCGrid?'':'<button class="layout_copy" title="复制一个">〓</button>';
	var scm = isCGrid?'<button class="layout_move_left" title="切换到左边">←</button><button class="layout_move_right" title="切换到右边">→</button>':'<button class="layout_move_up" title="切换到上面">↑</button><button class="layout_move_down" title="切换到下面">↓</button>';
	var smd = hasGrids?'':'<button class="layout_module" title="添加模组">╋</button>';
	var scfg = bAT?scm+scp+'<button class="layout_remove" title="移除这个单元">×</button>'+smd:smd;
	if(hasGrids){
		var dCfg = document.createElement('div');
		dCfg.className = "layout_cfg";
		dCfg.innerHTML = scfg;
		dGrid.insertBefore(dCfg,dGrid.childNodes[0]);
	}else{
		aRIH.push('<div class="layout_cfg">'+scfg+'</div>');
		aRIH.push('<div class="layout_mod">'+sIH+'</div>');
		dGrid.innerHTML = aRIH.join('');
		dGrid.childNodes[1].contentEditable = true;
	}
	sIH = aRIH = scfg = null;
};
var initPage = function(){
	var dh = document.getElementById('hd').getElementsByTagName('div');
	var db = document.getElementById('bd').getElementsByTagName('div');
	var df = document.getElementById('ft').getElementsByTagName('div');
	var renderGDPanel = function(dgs,bAT){
		var dn = null,sdn = '',ld = dgs.length,dLayout = [],ldl = 0;
		for(var n=0;n<ld;n++){
			dn = dgs[n],sdn = dn.className;
			if(/\blayout\b/i.test(sdn)){dLayout.push(dn);ldl++;}
		}
		for(n=0;n<ldl;n++){gridPanel(dLayout[n],bAT);}
	};
	renderGDPanel(dh),renderGDPanel(db,true),renderGDPanel(df);
	document.body.onclick = function(e){
		e = e||window.event;
		var dtarget = e.target||e.srcElement,sclass = dtarget.className;
		switch(sclass){
			case "layout_move_up":
			case "layout_move_left":
				var dgrid = dtarget.parentNode.parentNode,dp = dgrid.previousSibling,dgrid2 = (dp&&dp.nodeType!=3)?dp:dp?dp.previousSibling:null;
				if(!dgrid2||!(/\blayout\b/i.test(dgrid2.className))){return;}
				exchangeNode(dgrid2,dgrid,1);
				break;
			case "layout_move_down":
			case "layout_move_right":
				var dgrid = dtarget.parentNode.parentNode,dp = dgrid.nextSibling,dgrid2 = (dp&&dp.nodeType!=3)?dp:dp?dp.nextSibling:null;
				if(!dgrid2||!(/\blayout\b/i.test(dgrid2.className))){return;}
				exchangeNode(dgrid,dgrid2,0);
				break;
			case "layout_copy":
				var dgrid = dtarget.parentNode.parentNode,dclone = dgrid.cloneNode(true),dparent = dgrid.parentNode;
				dparent.insertBefore(dclone,dgrid);
				exchangeNode(dclone,dgrid,0);
				break;
			case "layout_remove":
				var dgrid = dtarget.parentNode.parentNode,dparent = dgrid.parentNode;
				dparent.removeChild(dgrid);
				break;
		}
	};
};
initPage();
</script>
</html>]]></NineSixty><push author="dh20156" date="" common="注意push的参数形式"><![CDATA[<script type="text/javascript">
  
var a = [],b = [],c = [];
a.push([1,2]);
a.push([3,4]);
Array.prototype.push.apply(b,[1,2]);
Array.prototype.push.apply(b,[3,4]);
c.push(5,6);
c.push(7,8);

alert(a+'\n'+a.length+'\n'+a[0]);
alert(b+'\n'+b.length+'\n'+b[0]);
alert(c+'\n'+c.length+'\n'+c[0]);

</script>]]></push><javascriptBasis author="" date="" common=""><![CDATA[<script type="text/javascript">

//请先写出以下代码中问号处的答案，再运行比较！

var a=0,b=0,c=0;
a+++b+++c;
alert([a,b,c]);//?

var a=[];
alert(a[a++]);//?
alert(a);//?

var o={a:o++};
alert(o.a);//?

var f=function(){};
alert(f(f++));

alert(typeof(NaN))//?

alert(typeof(Infinity))//?

alert(typeof(null))//?

alert(typeof(undefined))//?

alert(NaN == NaN)//?

alert(NaN != NaN)//?

alert(NaN >= NaN)//?

alert(null == undefined)//?

alert(null >= undefined)//?

alert(null <= undefined)//?

alert(parseInt("123abc"))//?

alert(("123abc" - 0))//?

alert(Infinity > 10)//?

alert(Infinity > "abc")//?

alert(Infinity == NaN)//?

alert(true == 1)//?

alert(new String("abc") == "abc")//?

alert(new String("abc") === "abc")//?

var a = "123abc";
alert(typeof(a++));//?
alert(a);//?

var a = "123abc";
a.valueOf = function(){return parseInt(a);}
alert(++a);//?
alert(a-0);//?

var a = new Object();
a.toString = function(){return "123abc";}
a.valueOf = function(){return parseInt(a);}
alert(++a);//?
alert(a-0);//?

var spv = String.prototype.valueOf;
String.prototype.valueOf = function(){
    return parseFloat(this);
}
alert("123abc" > 122);//?
alert(new String("123abc") > 122);//?
String.prototype.valueOf = spv;

var s = new String("abc");
alert(typeof(s) == typeof("abc"));//?
alert(s === "abc");//?
alert(s.toString() == s);//?

var a = new Object(),b = new Object();
a.toString = function(){return "a"};
b.toString = function(){return "b"};
alert(a>b);//?
a.valueOf = function(){return 1};
b.valueOf = function(){return 0};
alert(a>b);//?

var step = function(a){
    return function(x){
        return x + a++;
    }
}
var a = step(10);
var b = step(20);
alert(a(10));//?
alert(b(10));//?

</script>]]></javascriptBasis><earthcam author="" date="" common=""><![CDATA[<img src="http://images.earthcam.com/ec_metros/newyork/newyork/lindys.jpg" />
<img src="http://images.earthcam.com/ec_metros/ourcams/ltm.jpg" />
<script type="text/javascript">
var ocmr = {
    dimg:document.getElementsByTagName('img'),
    surl:['http://images.earthcam.com/ec_metros/newyork/newyork/lindys.jpg','http://images.earthcam.com/ec_metros/ourcams/ltm.jpg']
};
var foorl = function(){
    var dimg = ocmr.dimg,surl = ocmr.surl;
    for(var i=0;i<dimg.length;i++){
        dimg[i].src = surl[i]+'?rnd='+Math.random();
    }
    window.setTimeout(arguments.callee,2000);
};
foorl();
</script>]]></earthcam><IframeScrollCompatible author="dh20156" date="" common=""><![CDATA[<iframe src="dhtabstrip/tsO.htm" width="300" height="200" frameborder="0" scrolling="no"></iframe>

<button>show iframe scrolls bar</button>

<script type="text/javascript">
var difr = document.getElementsByTagName('iframe')[0];
var dbtn = document.getElementsByTagName('button')[0];
dbtn.onclick = function(){
    difr.scrolling = 'auto';
    difr.contentWindow.document.body.scroll = 'auto';
};
</script>]]></IframeScrollCompatible><clearRepeat author="dh20156" date="" common="去掉字符串中组合出现过的重复字符"><![CDATA[<script type="text/javascript">
var r = "abc,efg,bac,gfe,acb,feg,正则式,ijh,式正则,hji,则正式";

var reg = /((.)(.)(.)),(?=.*?(\2|\3|\4))/ig;

var rs = r.replace(reg,function(){var args=Array.prototype.slice.call(arguments,0);alert(args.join('\n'));return '';});

alert(rs);
</script>]]></clearRepeat><iframeCloseBug author="Rank" date="" common="iframe未正确闭合BUG"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Rank's HTML document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<h1>坑</h1>
<div class="hd"><h3>hi, guy</h3></div>
<div class="bd"><p>where is your alert of your javascript?</p></div>
<iframe src="about:blank" frameborder="0" />
</body>
<script type="text/javascript">
alert('恭喜你，这个alert执行了!');
</script>
</html>]]></iframeCloseBug><JSMinifier author="Franck Marcia" date="" common="在线压缩JavaScript代码"><![CDATA[<html>
<head>
<title>JS Minifier</title>
<script type="text/javascript">
String.prototype.has=function(c){return this.indexOf(c)>-1;};function jsmin(comment,input,level){if(input===undefined){input=comment;comment='';level=2;}else if(level===undefined||level<1||level>3){level=2;}if(comment.length>0){comment+='\n';}var a='',b='',EOF=-1,LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',DIGITS='0123456789',ALNUM=LETTERS+DIGITS+'_$\\',theLookahead=EOF;function isAlphanum(c){return c!=EOF&&(ALNUM.has(c)||c.charCodeAt(0)>126);}function get(){var c=theLookahead;if(get.i==get.l){return EOF;}theLookahead=EOF;if(c==EOF){c=input.charAt(get.i);++get.i;}if(c>=' '||c=='\n'){return c;}if(c=='\r'){return'\n';}return' ';}get.i=0;get.l=input.length;function peek(){theLookahead=get();return theLookahead;}function next(){var c=get();if(c=='/'){switch(peek()){case'/':for(;;){c=get();if(c<='\n'){return c;}}break;case'*':get();for(;;){switch(get()){case'*':if(peek()=='/'){get();return' ';}break;case EOF:throw'Error: Unterminated comment.';}}break;default:return c;}}return c;}function action(d){var r=[];if(d==1){r.push(a);}if(d<3){a=b;if(a=='\''||a=='"'){for(;;){r.push(a);a=get();if(a==b){break;}if(a<='\n'){throw'Error: unterminated string literal: '+a;}if(a=='\\'){r.push(a);a=get();}}}}b=next();if(b=='/'&&'(,=:[!&|'.has(a)){r.push(a);r.push(b);for(;;){a=get();if(a=='/'){break;}else if(a=='\\'){r.push(a);a=get();}else if(a<='\n'){throw'Error: unterminated Regular Expression literal';}r.push(a);}b=next();}return r.join('');}function m(){var r=[];a='\n';r.push(action(3));while(a!=EOF){switch(a){case' ':if(isAlphanum(b)){r.push(action(1));}else{r.push(action(2));}break;case'\n':switch(b){case'{':case'[':case'(':case'+':case'-':r.push(action(1));break;case' ':r.push(action(3));break;default:if(isAlphanum(b)){r.push(action(1));}else{if(level==1&&b!='\n'){r.push(action(1));}else{r.push(action(2));}}}break;default:switch(b){case' ':if(isAlphanum(a)){r.push(action(1));break;}r.push(action(3));break;case'\n':if(level==1&&a!='\n'){r.push(action(1));}else{switch(a){case'}':case']':case')':case'+':case'-':case'"':case'\'':if(level==3){r.push(action(3));}else{r.push(action(1));}break;default:if(isAlphanum(a)){r.push(action(1));}else{r.push(action(3));}}}break;default:r.push(action(1));break;}}}return r.join('');}jsmin.oldSize=input.length;ret=m(input);jsmin.newSize=ret.length;return comment+ret;}
function $(i) {return document.getElementById(i);}
function go() {
			$('output').value = jsmin($('comment').value, $('input').value, $('level').value);
			$('outputtitle').style.display = $('output').style.display = $('statstitle').style.display = $('stats').style.display = 'block';
			$('oldsize').value = jsmin.oldSize;
			$('newsize').value = jsmin.newSize;
			$('ratio').value = (Math.round(jsmin.newSize / jsmin.oldSize * 1000) / 10) + '%';
		}
		function bw() {
			$('comment').value = $('input').value = $('output').value = '';
			$('outputtitle').style.display = $('output').style.display = $('statstitle').style.display = $('stats').style.display = 'none';
}
</script>
<style type="text/css">
#comment { width:95%; height:4em; }
#input { width:95%; height:10em; }
#go { font-weight:bold; }
#outputtitle, #statstitle, #stats { display:none; }
#oldsize, #newsize, #ratio { text-align:right; width:4em; }
#output { width:95%; height:10em;display:none; }
h2 { margin-bottom:0; }
</style>
</head>
<body bgcolor="linen">
	<h1>JS Minifier</h1>
	<p>By Franck Marcia, 
	From the <a href="http://javascript.crockford.com/jsmin.html" target="_blank">original idea</a> of <a href="http://www.crockford.com/" target="_blank">Douglas Crockford</a>, 
	Last modified: 2006/08/31</p>
	<hr/>
	<h2>Comments</h2>
	<textarea id="comment" name="comment"></textarea>
	<h2>Code</h2>
	<textarea id="input" name="input"></textarea>
	<br/><br/>
	<center>
		Level:&nbsp;
		<select id="level">
			<option value="1">minimal</option>
			<option value="2" selected="selected">conservative</option>
			<option value="3">agressive</option>
		</select>
		&nbsp;&nbsp;
		<input id="go" type="submit" value="JSMin" onclick="go();return false;"/>
		&nbsp;&nbsp;
		<input type="submit" value="Clear" onclick="bw();return false;"/><br/><br/>
		<small><b>Minimal</b>: original algorithm but keep linefeeds if single - <b>Conservative</b>: original algorithm - <b>Agressive</b>: remove more linefeed than the original algorithm but can be regressive</small>
	</center>
	<h2 id="outputtitle">Output</h2>
	<textarea id="output" name="output"></textarea>
	<h2 id="statstitle">Stats</h2>
	<div id="stats">Old size: <input id="oldsize"></span> New size: <input id="newsize"></span> Ratio: <input id="ratio"></span></div>
</body>
</html>]]></JSMinifier><preload author="dh20156" date="" common="加载页面效果"><![CDATA[<html>
<head>
<style type="text/css">
body{width:100%;height:100%;overflow:hidden;background:url(http://www.v-ec.com/ijc/ajax-loader.gif) center center no-repeat;}
</style>
</head>
<body>
<iframe src="http://www.w3cgroup.com" style="display:none;"></iframe>
</body>
<script>
window.onload=function(){window.location='http://www.w3cgroup.com';}
window.onunload=function(){window.onload=null;}
</script>
</html>]]></preload><iframeMouseInOut author="dh20156" date="" common="鼠标进入离开iframe事件"><![CDATA[<body>
<iframe id="x" src="x.htm"></iframe>
</body>
<script>
var dx = document.getElementById('x');
dx.contentWindow.onmousemove = function(){document.title='in';};
dx.contentWindow.document.onmousemove = function(){document.title='in';};
dx.onmouseout = function(){document.title='out';};
</script>]]></iframeMouseInOut><logoVAlign author="dh20156" date="" common="模板中logo和标题字的垂直居中"><![CDATA[<style type="text/css">
.logo{height:150px;overflow:hidden;background:#efefef;}
h3{line-height:150px;}
h3 img{float:left;margin-right:20px;visibility:hidden;}
</style>

<div class="logo">
<h3 style="background:url(http://www.v-ec.com/ijc/jslab_logo.png) 0 center no-repeat;"><a href="{company_url}" title="{company_name}"><img src="http://www.v-ec.com/ijc/jslab_logo.png" alt="{company_name}" />{company_name}</a></h3>
</div>]]></logoVAlign><IEgetAttributeNode author="dh20156" date="" common="IE下注意getAttributeNode进行boolean判断"><![CDATA[<input type="text" id="x" value="IE getAttributeNode" />

<script type="text/javascript">

var dx = document.getElementById('x');

var hasAtt = dx.getAttributeNode('disabled').value;

alert(hasAtt);

if(!hasAtt){alert('You will not see me!');}

</script>]]></IEgetAttributeNode><ListTable author="doyoe" date="" common="列表表格布局"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-cn" />
<title>test</title>
<meta name="Description" content="" />
<meta name="Keywords" content="" />
<meta name="author" content="Doyoe(飘零雾雨), dooyoe@gmail.com" />
<style type="text/css">
#test{width:290px;background:#eee;}
#test ul{overflow:hidden;zoom:1;margin:0;padding:0 5px 10px 5px;}
#test li{display:inline;float:left;width:60px;height:60px;margin:10px 5px 0;list-style:none;background:#333;}
</style>
</head>
<body>
<div id="test">
<ul>
	<li>aaa</li>
	<li>bbb</li>
	<li>ccc</li>
	<li>ddd</li>
	<li>eee</li>
	<li>fff</li>
	<li>ggg</li>
	<li>hhh</li>
	<li>aaa</li>
	<li>bbb</li>
	<li>ccc</li>
	<li>ddd</li>
	<li>eee</li>
	<li>fff</li>
	<li>ggg</li>
	<li>hhh</li>
</ul>
</div>
</body>
</html>]]></ListTable><JSTweener author="Yuichi Tateno" date="" common="javascript版缓动"><![CDATA[<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <title>JSTweener Example - Transitoins</title>
    <script language="JavaScript">
/*start js tweener*/
/*
 * Yuichi Tateno. <hotchpotch@N0!spam@gmail.com>
 * http://rails2u.com/
 * 
 * The MIT License
 * --------
 * Copyright (c) 2007 Yuichi Tateno.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */

var JSTweener = {
    looping: false,
    frameRate: 60,
    objects: [],
    defaultOptions: {
        time: 1,
        transition: 'easeoutexpo',
        delay: 0,
        prefix: {},
        suffix: {},
        onStart: undefined,
        onStartParams: undefined,
        onUpdate: undefined,
        onUpdateParams: undefined,
        onComplete: undefined,
        onCompleteParams: undefined
    },
    inited: false,
    easingFunctionsLowerCase: {},
    init: function() {
        this.inited = true;
        for (var key in JSTweener.easingFunctions) {
            this.easingFunctionsLowerCase[key.toLowerCase()] = JSTweener.easingFunctions[key];
        }
    },
    toNumber: function(value, prefix, suffix) {
        // for style
        if (!suffix) suffix = 'px';

        return value.toString().match(/[0-9]/) ? Number(value.toString().replace(
                                                        new RegExp(suffix + '$'), ''
                                                       ).replace(
                                                        new RegExp('^' + (prefix ? prefix : '')), ''
                                                       ))
                                               : 0;
    },
    addTween: function(obj, options) {
        var self = this;
        if (!this.inited) this.init();
        var o = {};
        o.target = obj;
        o.targetPropeties = {};
        
        for (var key in this.defaultOptions) {
            if (typeof options[key] != 'undefined') {
                o[key] = options[key];
                delete options[key];
            } else {
                o[key] = this.defaultOptions[key];
            }
        }

        if (typeof o.transition == 'function') {
            o.easing = o.transition;
        } else {
            o.easing = this.easingFunctionsLowerCase[o.transition.toLowerCase()];
        }

        for (var key in options) {
            if (!o.prefix[key]) o.prefix[key] = '';
            if (!o.suffix[key]) o.suffix[key] = '';
            var sB = this.toNumber(obj[key], o.prefix[key],  o.suffix[key]);
            o.targetPropeties[key] = {
                b: sB,
                c: options[key] - sB
            };
        }

        setTimeout(function() {
            o.startTime = (new Date() - 0);
            o.endTime = o.time * 1000 + o.startTime;

            if (typeof o.onStart == 'function') {
                if (o.onStartParams) {
                    o.onStart.apply(o, o.onStartParams);
                } else {
                    o.onStart();
                }
            }

            self.objects.push(o);
            if (!self.looping) { 
                self.looping = true;
                self.eventLoop.call(self);
            }
        }, o.delay * 1000);
    },
    eventLoop: function() {
        var now = (new Date() - 0);
        for (var i = 0; i < this.objects.length; i++) {
            var o = this.objects[i];
            var t = now - o.startTime;
            var d = o.endTime - o.startTime;

            if (t >= d) {
                for (var property in o.targetPropeties) {
                    var tP = o.targetPropeties[property];
                    try {
                        o.target[property] = o.prefix[property] + (tP.b + tP.c) + o.suffix[property];
                    } catch(e) {}
                }
                this.objects.splice(i, 1);

                if (typeof o.onUpdate == 'function') {
                    if (o.onUpdateParams) {
                        o.onUpdate.apply(o, o.onUpdateParams);
                    } else {
                        o.onUpdate();
                    }
                }

                if (typeof o.onComplete == 'function') {
                    if (o.onCompleteParams) {
                        o.onComplete.apply(o, o.onCompleteParams);
                    } else {
                        o.onComplete();
                    }
                }
            } else {
                for (var property in o.targetPropeties) {
                    var tP = o.targetPropeties[property];
                    var val = o.easing(t, tP.b, tP.c, d);
                    try {
                        // FIXME:For IE. A Few times IE (style.width||style.height) = value is throw error...
                        o.target[property] = o.prefix[property] + val + o.suffix[property];
                    } catch(e) {}
                }

                if (typeof o.onUpdate == 'function') {
                    if (o.onUpdateParams) {
                        o.onUpdate.apply(o, o.onUpdateParams);
                    } else {
                        o.onUpdate();
                    }
                }
            }
        }

        if (this.objects.length > 0) {
            var self = this;
            setTimeout(function() { self.eventLoop() }, 1000/self.frameRate);
        } else {
            this.looping = false;
        }
    }
};

JSTweener.Utils = {
    bezier2: function(t, p0, p1, p2) {
         return (1-t) * (1-t) * p0 + 2 * t * (1-t) * p1 + t * t * p2;
    },
    bezier3: function(t, p0, p1, p2, p3) {
         return Math.pow(1-t, 3) * p0 + 3 * t * Math.pow(1-t, 2) * p1 + 3 * t * t * (1-t) * p2 + t * t * t * p3;
    },
    allSetStyleProperties: function(element) {
         var css;
         if (document.defaultView && document.defaultView.getComputedStyle) {
             css = document.defaultView.getComputedStyle(element, null);
         } else {
             css = element.currentStyle
         }
         for (var key in css) {
             if (!key.match(/^\d+$/)) {
                 try {
                 element.style[key] = css[key];
                 } catch(e) {};
             }
         }
    }
}

/*
 * JSTweener.easingFunctions is
 * Tweener's easing functions (Penner's Easing Equations) porting to JavaScript.
 * http://code.google.com/p/tweener/
 */

JSTweener.easingFunctions = {
    easeNone: function(t, b, c, d) {
        return c*t/d + b;
    },    
    easeInQuad: function(t, b, c, d) {
        return c*(t/=d)*t + b;
    },    
    easeOutQuad: function(t, b, c, d) {
        return -c *(t/=d)*(t-2) + b;
    },    
    easeInOutQuad: function(t, b, c, d) {
        if((t/=d/2) < 1) return c/2*t*t + b;
        return -c/2 *((--t)*(t-2) - 1) + b;
    },    
    easeInCubic: function(t, b, c, d) {
        return c*(t/=d)*t*t + b;
    },    
    easeOutCubic: function(t, b, c, d) {
        return c*((t=t/d-1)*t*t + 1) + b;
    },    
    easeInOutCubic: function(t, b, c, d) {
        if((t/=d/2) < 1) return c/2*t*t*t + b;
        return c/2*((t-=2)*t*t + 2) + b;
    },    
    easeOutInCubic: function(t, b, c, d) {
        if(t < d/2) return JSTweener.easingFunctions.easeOutCubic(t*2, b, c/2, d);
        return JSTweener.easingFunctions.easeInCubic((t*2)-d, b+c/2, c/2, d);
    },    
    easeInQuart: function(t, b, c, d) {
        return c*(t/=d)*t*t*t + b;
    },    
    easeOutQuart: function(t, b, c, d) {
        return -c *((t=t/d-1)*t*t*t - 1) + b;
    },    
    easeInOutQuart: function(t, b, c, d) {
        if((t/=d/2) < 1) return c/2*t*t*t*t + b;
        return -c/2 *((t-=2)*t*t*t - 2) + b;
    },    
    easeOutInQuart: function(t, b, c, d) {
        if(t < d/2) return JSTweener.easingFunctions.easeOutQuart(t*2, b, c/2, d);
        return JSTweener.easingFunctions.easeInQuart((t*2)-d, b+c/2, c/2, d);
    },    
    easeInQuint: function(t, b, c, d) {
        return c*(t/=d)*t*t*t*t + b;
    },    
    easeOutQuint: function(t, b, c, d) {
        return c*((t=t/d-1)*t*t*t*t + 1) + b;
    },    
    easeInOutQuint: function(t, b, c, d) {
        if((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
        return c/2*((t-=2)*t*t*t*t + 2) + b;
    },    
    easeOutInQuint: function(t, b, c, d) {
        if(t < d/2) return JSTweener.easingFunctions.easeOutQuint(t*2, b, c/2, d);
        return JSTweener.easingFunctions.easeInQuint((t*2)-d, b+c/2, c/2, d);
    },    
    easeInSine: function(t, b, c, d) {
        return -c * Math.cos(t/d *(Math.PI/2)) + c + b;
    },    
    easeOutSine: function(t, b, c, d) {
        return c * Math.sin(t/d *(Math.PI/2)) + b;
    },    
    easeInOutSine: function(t, b, c, d) {
        return -c/2 *(Math.cos(Math.PI*t/d) - 1) + b;
    },    
    easeOutInSine: function(t, b, c, d) {
        if(t < d/2) return JSTweener.easingFunctions.easeOutSine(t*2, b, c/2, d);
        return JSTweener.easingFunctions.easeInSine((t*2)-d, b+c/2, c/2, d);
    },    
    easeInExpo: function(t, b, c, d) {
        return(t==0) ? b : c * Math.pow(2, 10 *(t/d - 1)) + b - c * 0.001;
    },    
    easeOutExpo: function(t, b, c, d) {
        return(t==d) ? b+c : c * 1.001 *(-Math.pow(2, -10 * t/d) + 1) + b;
    },    
    easeInOutExpo: function(t, b, c, d) {
        if(t==0) return b;
        if(t==d) return b+c;
        if((t/=d/2) < 1) return c/2 * Math.pow(2, 10 *(t - 1)) + b - c * 0.0005;
        return c/2 * 1.0005 *(-Math.pow(2, -10 * --t) + 2) + b;
    },    
    easeOutInExpo: function(t, b, c, d) {
        if(t < d/2) return JSTweener.easingFunctions.easeOutExpo(t*2, b, c/2, d);
        return JSTweener.easingFunctions.easeInExpo((t*2)-d, b+c/2, c/2, d);
    },    
    easeInCirc: function(t, b, c, d) {
        return -c *(Math.sqrt(1 -(t/=d)*t) - 1) + b;
    },    
    easeOutCirc: function(t, b, c, d) {
        return c * Math.sqrt(1 -(t=t/d-1)*t) + b;
    },    
    easeInOutCirc: function(t, b, c, d) {
        if((t/=d/2) < 1) return -c/2 *(Math.sqrt(1 - t*t) - 1) + b;
        return c/2 *(Math.sqrt(1 -(t-=2)*t) + 1) + b;
    },    
    easeOutInCirc: function(t, b, c, d) {
        if(t < d/2) return JSTweener.easingFunctions.easeOutCirc(t*2, b, c/2, d);
        return JSTweener.easingFunctions.easeInCirc((t*2)-d, b+c/2, c/2, d);
    },    
    easeInElastic: function(t, b, c, d, a, p) {
        var s;
        if(t==0) return b;  if((t/=d)==1) return b+c;  if(!p) p=d*.3;
        if(!a || a < Math.abs(c)) { a=c; s=p/4; } else s = p/(2*Math.PI) * Math.asin(c/a);
        return -(a*Math.pow(2,10*(t-=1)) * Math.sin((t*d-s)*(2*Math.PI)/p )) + b;
    },    
    easeOutElastic: function(t, b, c, d, a, p) {
        var s;
        if(t==0) return b;  if((t/=d)==1) return b+c;  if(!p) p=d*.3;
        if(!a || a < Math.abs(c)) { a=c; s=p/4; } else s = p/(2*Math.PI) * Math.asin(c/a);
        return(a*Math.pow(2,-10*t) * Math.sin((t*d-s)*(2*Math.PI)/p ) + c + b);
    },    
    easeInOutElastic: function(t, b, c, d, a, p) {
        var s;
        if(t==0) return b;  if((t/=d/2)==2) return b+c;  if(!p) p=d*(.3*1.5);
        if(!a || a < Math.abs(c)) { a=c; s=p/4; }       else s = p/(2*Math.PI) * Math.asin(c/a);
        if(t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin((t*d-s)*(2*Math.PI)/p )) + b;
        return a*Math.pow(2,-10*(t-=1)) * Math.sin((t*d-s)*(2*Math.PI)/p )*.5 + c + b;
    },    
    easeOutInElastic: function(t, b, c, d, a, p) {
        if(t < d/2) return JSTweener.easingFunctions.easeOutElastic(t*2, b, c/2, d, a, p);
        return JSTweener.easingFunctions.easeInElastic((t*2)-d, b+c/2, c/2, d, a, p);
    },    
    easeInBack: function(t, b, c, d, s) {
        if(s == undefined) s = 1.70158;
        return c*(t/=d)*t*((s+1)*t - s) + b;
    },    
    easeOutBack: function(t, b, c, d, s) {
        if(s == undefined) s = 1.70158;
        return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
    },    
    easeInOutBack: function(t, b, c, d, s) {
        if(s == undefined) s = 1.70158;
        if((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
        return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
    },    
    easeOutInBack: function(t, b, c, d, s) {
        if(t < d/2) return JSTweener.easingFunctions.easeOutBack(t*2, b, c/2, d, s);
        return JSTweener.easingFunctions.easeInBack((t*2)-d, b+c/2, c/2, d, s);
    },    
    easeInBounce: function(t, b, c, d) {
        return c - JSTweener.easingFunctions.easeOutBounce(d-t, 0, c, d) + b;
    },    
    easeOutBounce: function(t, b, c, d) {
        if((t/=d) <(1/2.75)) {
            return c*(7.5625*t*t) + b;
        } else if(t <(2/2.75)) {
            return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
        } else if(t <(2.5/2.75)) {
            return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
        } else {
            return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
        }
    },    
    easeInOutBounce: function(t, b, c, d) {
        if(t < d/2) return JSTweener.easingFunctions.easeInBounce(t*2, 0, c, d) * .5 + b;
        else return JSTweener.easingFunctions.easeOutBounce(t*2-d, 0, c, d) * .5 + c*.5 + b;
    },    
    easeOutInBounce: function(t, b, c, d) {
        if(t < d/2) return JSTweener.easingFunctions.easeOutBounce(t*2, b, c/2, d);
        return JSTweener.easingFunctions.easeInBounce((t*2)-d, b+c/2, c/2, d);
    }
};
JSTweener.easingFunctions.linear = JSTweener.easingFunctions.easeNone;

/*end*/
      function getTime() {
        return document.getElementById('time').value;
      };
      function getTranstion() {
        return document.getElementById('transition').value;
      };
      function move1() {
        JSTweener.addTween(square.style, {
            time: getTime(),
            transition: getTranstion(),
            onComplete: move2,
            left: 400
        });
      }
      function move2() {
        JSTweener.addTween(square.style, {
            time: getTime(),
            transition: getTranstion(),
            onComplete: move3,
            top: 300
        });
      }
      function move3() {
        JSTweener.addTween(square.style, {
            time: getTime(),
            transition: getTranstion(),
            onComplete: move4,
            left: 100
        });
      }
      function move4() {
        JSTweener.addTween(square.style, {
            time: getTime(),
            transition: getTranstion(),
            onComplete: move1,
            top: 100
        });
      }
    </script>

    <style type="text/css">
      body {
        color: #FFFFFF;
        background-color: #000000;
      }
      #square {
        background-color: #FF0000;
        border:1px solid #FFAA00;
        position:absolute;
        width:30;
        height:30;
        top:100px;
        left:100px;
      }

      #border {
        border:1px solid #555555;
        position:absolute;
        width:332;
        height:232;
        top:99px;
        left:99px;
      }
    </style>
  </head>
  <body>
    <h1>JSTweener Example - Transitoins</h1>
    <p>
    <label for="time">Time:</label> <input id="time" size="4" type="text" value="1"></input>
    <a href="http://hosted.zeh.com.br/tweener/docs/en-us/misc/transitions.html">transition</a>:
    <select id="transition">

      <option value="linear">linear</options>
      <option value="easeInQuad">easeInQuad</options>
      <option value="easeOutQuad">easeOutQuad</options>
      <option value="easeInOutQuad">easeInOutQuad</options>
      <option value="easeInCubic">easeInCubic</options>
      <option value="easeOutCubic">easeOutCubic</options>

      <option value="easeInOutCubic">easeInOutCubic</options>
      <option value="easeOutInCubic">easeOutInCubic</options>
      <option value="easeInQuart">easeInQuart</options>
      <option value="easeOutQuart">easeOutQuart</options>
      <option value="easeInOutQuart">easeInOutQuart</options>
      <option value="easeOutInQuart">easeOutInQuart</options>

      <option value="easeInQuint">easeInQuint</options>
      <option value="easeOutQuint">easeOutQuint</options>
      <option value="easeInOutQuint">easeInOutQuint</options>
      <option value="easeOutInQuint">easeOutInQuint</options>
      <option value="easeInSine">easeInSine</options>
      <option value="easeOutSine">easeOutSine</options>

      <option value="easeInOutSine">easeInOutSine</options>
      <option value="easeOutInSine">easeOutInSine</options>
      <option value="easeInExpo">easeInExpo</options>
      <option value="easeOutExpo">easeOutExpo</options>
      <option value="easeInOutExpo">easeInOutExpo</options>
      <option value="easeOutInExpo">easeOutInExpo</options>

      <option value="easeInCirc">easeInCirc</options>
      <option value="easeOutCirc">easeOutCirc</options>
      <option value="easeInOutCirc">easeInOutCirc</options>
      <option value="easeOutInCirc">easeOutInCirc</options>
      <option value="easeInElastic">easeInElastic</options>
      <option value="easeOutElastic">easeOutElastic</options>

      <option value="easeInOutElastic">easeInOutElastic</options>
      <option value="easeOutInElastic">easeOutInElastic</options>
      <option value="easeInBack">easeInBack</options>
      <option value="easeOutBack">easeOutBack</options>
      <option value="easeInOutBack">easeInOutBack</options>
      <option value="easeOutInBack">easeOutInBack</options>

      <option value="easeInBounce">easeInBounce</options>
      <option value="easeOutBounce">easeOutBounce</options>
      <option value="easeInOutBounce">easeInOutBounce</options>
      <option value="easeOutInBounce">easeOutInBounce</options>
    </select>
    </p>
    <div id="square">&nbsp;</div>

    <div id="border">&nbsp;</div>
    <script language="JavaScript">
      var square = document.getElementById('square');
      square.style.top = 100;
      square.style.left= 100;
      move1();
    </script>
  </body>
</html>]]></JSTweener><attributesOrder author="dh20156" date="" common="IE,FF,NS的attributes索引顺序需要反转"><![CDATA[<div txt="b" href="c" target="d">a</div>
<script>
var da = document.getElementsByTagName('div')[0];
var daa = da.attributes,dal = daa.length;
var ppt = [];
var bnr = /(?:ie|firefox)/i.test(navigator.userAgent);
//IE的属性中如果有id等某元素固有属性，排序又不相同
for(var i=0;i<dal;i++){
    if(daa[i].specified){ppt.push(daa[i].value);}
}
if(bnr){ppt = ppt.reverse();}
alert(ppt);
</script>]]></attributesOrder><removeSelectOptions author="" date="" common="移除下拉框选项"><![CDATA[<select id="x">
<option>1</option>
<option>2</option>
<option>3</option>
</select>

<script type="text/javascript">
var dx = document.getElementById('x');
dx.options.length=0;
</script>]]></removeSelectOptions><LED author="dh20156" date="" common="基于表格的行为处理方式测试"><![CDATA[<style>
html,body{text-align:center;}
#x{margin:0 auto;background:#333;}
#x td{width:43px;height:43px;background:#000;}
#x td.active{background:#f00;}
#x td.stop{background:#00f;}
</style>
<table cellspacing="1" cellpadding="0" border="0" id="x">
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
</table><button id="y">move down</button>
<script>
var led = function(){
    this.groups = [];
    this.setstop = function(r,c){this.rows[r].cells[c].className='stop';this.rows[r].cells[c].stop=true;}
    this.setgroup = function(list){for(var i=0;i<list.length;i++){this.rows[list[i][0]].cells[list[i][1]].className='active';}this.groups.push(list.sort(function(a,b){return b[0]-a[0];}));};
    this.alldown = 0;
    this.down = function(groupidx){
		var l = this.rows.length-1,me = this;
		var pd = this.groups[groupidx].sort(function(a,b){return b[0]-a[0];}),pa = pd[0],pb = pd[1],r = pa[0],c = pa[1],r2 = pb&&pb[0],c2 = pb&&pb[1];
		var scls = this.rows[r].cells[c].className,scls2 = pb&&this.rows[r2].cells[c2].className;
		var innerfoo = function(){
			if(r>=l||me.rows[r+1].cells[c].stop||(pb&&r2==r&&me.rows[r2+1].cells[c2].stop)){
				me.rows[r].cells[c].stop = true;
				if(pb){me.rows[r2].cells[c2].stop = true;}
				me.alldown--;
				if(!me.alldown){alert('all down!');}
				return;
			}
			me.rows[r].cells[c].className = '';
			if(pb){me.rows[r2].cells[c2].className = '';}
			r++,r2++;
			me.rows[r].cells[c].className = scls;
			if(pb){me.rows[r2].cells[c2].className = scls2;}
			window.setTimeout(arguments.callee,200);
		};
		innerfoo();
	};
    this.move = function(){var i=0,act=this.groups.sort(function(a,b){return b[0][0]-a[0][0];}),l=act.length;this.alldown=l;for(i=0;i<l;i++){this.down(i);}};
}
var dx = document.getElementById('x'),dy = document.getElementById('y');
led.call(dx);
dx.setstop(9,2);
dx.setstop(5,0);
dx.setstop(6,4);
dx.setgroup([[0,0],[0,1]]);
dx.setgroup([[0,3],[0,4]]);
dx.setgroup([[0,2],[1,2]]);
dy.onclick=function(){dx.move();};
</script>]]></LED><getsamelistfrommartix author="dh20156" date="" common="遍历二维矩阵找出相同的行和列"><![CDATA[<script type="text/javascript">
var d = [
[5,3,2,4,1],
[1,2,3,4,5],
[1,2,2,2,5],
[1,2,3,4,5],
[5,3,2,4,1]
];

var getsamelistfrommartix = function(list,minlength){
    var d = list.slice(0),r=d.length,c=d[0].length,iflag = new Array(c+1).join(1).split(''),ret = [];
    var pushrow = function(r0,c0,c1){var tmp=[];for(var i=c0;i<=c1;i++){tmp.push([r0,i]);}ret.push(tmp);};
    var pushcell = function(c0,r0,r1){var tmp=[];for(var i=r0;i<=r1;i++){tmp.push([i,c0]);}ret.push(tmp);};
    for(var i=0;i<r;i++){
        var nflag = 1;
        for(var n=0;n<c;n++){
            if(n<(c-1)&&d[i][n]==d[i][n+1]){nflag++;}else{if(nflag>=minlength){pushrow(i,(n-nflag+1),n);}nflag = 1;}
            if(i<(r-1)&&d[i][n]==d[i+1][n]){iflag[n]++;}else{if(iflag[n]>=minlength){pushcell(n,(i-iflag[n]+1),i);}iflag[n] = 1;}
        }
    }
    return ret.slice(0);
};

alert(d.join('\n')+'\n\n横向纵向至少3个一组的有：\n\n'+getsamelistfrommartix(d,3).join('\n'));
</script>]]></getsamelistfrommartix><clearTagProperty author="WC" date="" common="移除指定标签的on属性和值"><![CDATA[<textarea>
<h1 onclick="alert(0);">hello</h1>
<label id="lab" onclick="save()" onblur="save()" onclick= onblur="a" >test</label>
</textarea>
<script>
with (document.getElementsByTagName('textarea')[0]) {
	value = value.replace(/<label\b((?:"[^"]*"|'[^']*'|[^"'>])+)>/i, function (l) {
		return l.replace(/\son[^=]+=(?:"[^"]*"|'[^']*'|[^"'>\s]*)/ig, '');
	});
	alert(value);
}
</script>]]></clearTagProperty><DateDiff author="diffmaker" date="09-10-10" common=""><![CDATA[Date.prototype.firstdate = function(){
    var yyyy = this.getFullYear();
    var mtd = this.getMonth();
    return new Date(yyyy,mtd,1,0,0,0);
}
Date.prototype.lastdate = function(){
    var yyyy = this.getFullYear();
    var mtd = this.getMonth() + 1;
    var last = new Date(yyyy,mtd,1,0,0,0);
    return last.add("dd",-1);
}
Date.prototype.reset = function(part){
    var datecopy = new Date(Date.parse(this));
    switch(part){
        case "ss":
            datecopy.setSeconds(0);
            break;
        case "mi":
            datecopy.setMinutes(0);
            break;
        case "hh":
            datecopy.setHours(0);
            break;
        case "dd":
            datecopy.setDate(1);
            break;
        case "mm":
            datecopy.setMonth(0);
            break;
    }
    return datecopy;
}
Date.prototype.add = function(part,num){
    var datecopy;
    var ms = this.getTime();
    num = parseInt(num);
    switch(part){
        case "ms":
            ms +=  num;
            break;
        case "ss":
            ms +=  1000 * num;
            break;
        case "mi":
            ms +=  60 * 1000 * num;
            break;
        case "hh":
            ms +=  60 * 60 * 1000 * num;
            break;
        case "dd":
            ms +=  24 * 60 * 60 * 1000 * num;
            break;
        case "wk":
            ms +=  7 * 24 * 60 * 60 * 1000 * num;
            break;
        case "mm":
            datecopy = new Date(Date.parse(this));
            datecopy.setFullYear(this.getFullYear() + Math.floor((this.getMonth() + num) / 12));
            var mth = (this.getMonth() + num) % 12;
            if(mth < 0)mth +=  12;
            datecopy.setMonth(mth);
            break;
        case "qq":
            datecopy = new Date(Date.parse(this));
            datecopy.setFullYear(this.getFullYear() + Math.floor((this.getMonth() + 3 * num) / 12));
            var mth = (this.getMonth() + 3 * num) % 12;
            if(mth < 0)mth +=  12;
            datecopy.setMonth(mth);
            break;
        case "yy":
            datecopy = new Date(Date.parse(this));
            datecopy.setFullYear(this.getFullYear() + num);
            break;
    }
    if(datecopy == null)
        return new Date(ms);
    else
        return datecopy;
}
Date.prototype.diff = function(part,redate){
    var startdate,enddate,diff,tmp;
    var re = new RegExp(/^(\d{4})-(0?[1-9]|1[0-2])-(0?[1-9]|[1-2]\d|3[0-1])( (0?\d|1\d|2[0-3]):(0?\d|[1-5]\d):(0?\d|[1-5]\d)([.](\d{1,3}))?)?$/);
    var reprefix0 = new RegExp(/^0(\d)/);
    startdate = new Date(Date.parse(this));
    if(re.test(redate))
    {
        re.exec(redate);
        var yyyy = RegExp.$1;
        var mm = RegExp.$2;
        var dd = RegExp.$3;
        var hh = RegExp.$5;
        var mi = RegExp.$6;
        var ss = RegExp.$7;
        var ms = RegExp.$9;
        var yyyy = parseInt(yyyy);
        var mm = parseInt(delPrefixZero(mm)) - 1;
        dd = parseInt(delPrefixZero(dd));
        hh = parseInt(delPrefixZero(hh));
        mi = parseInt(delPrefixZero(mi));
        ss = parseInt(delPrefixZero(ss));
        ms = parseInt(delPrefixZero(ms));
        enddate = new Date(yyyy,mm,dd,hh,mi,ss);
    }
    else
    {
        try
        {
              enddate = new Date(Date.parse(redate));
        }
         catch(e)
        {
            alert(e);
            return;
        }
    }
    if(enddate == "Invalid Date"){
        alert("非法日期！");
        return;
    }else{
        switch(part){
            case "ss":
                diff = (enddate - this) / 1000;
                break;
            case "mi":
                diff = enddate.getMinutes() - this.getMinutes();
                startdate = startdate.reset("mi");
                startdate = startdate.reset("ss");
                enddate = enddate.reset("mi");
                enddate = enddate.reset("ss");
                diff += (enddate-startdate) / 1000 / 60;
                break;
            case "hh":
                diff = enddate.getHours() - this.getHours();
                startdate = startdate.reset("hh");
                startdate = startdate.reset("mi");
                startdate = startdate.reset("ss");
                enddate = enddate.reset("hh");
                enddate = enddate.reset("mi");
                enddate = enddate.reset("ss");
                diff += (enddate-startdate) / 1000 / 60 / 60;
                break;
            case "dd":
                diff = enddate.getDate() - this.getDate();
                startdate = startdate.reset("dd");
                startdate = startdate.reset("hh");
                startdate = startdate.reset("mi");
                startdate = startdate.reset("ss");
                enddate = enddate.reset("dd");
                enddate = enddate.reset("hh");
                enddate = enddate.reset("mi");
                enddate = enddate.reset("ss");
                diff += (enddate-startdate) / 1000 / 60 / 60 / 24;
                break;
            case "wk":
                tmp = enddate.getDay() - this.getDay() < 0 ? 1 : 0;
                diff = this.diff("dd",enddate) / 7;
                if(diff >= 0)diff += tmp;
                break;
            case "mm":
                diff = (enddate.getFullYear() - this.getFullYear()) * 12 + enddate.getMonth() - this.getMonth();
                break;
            case "qq":
                diff = this.diff("mm",enddate) / 3;
                diff = Math.floor(diff);
                break;
            case "yy":
                diff = enddate.getFullYear() - this.getFullYear();
                break;
            default:
                diff = (enddate - this);
        }
        diff = parseInt(diff);
        return diff;
    }
    function delPrefixZero(str)
    {
        var re = new RegExp(/^0*/);
        str = str.replace(re,"");
        if(str == "")str = "0";
        return str;
    }
}]]></DateDiff><capture author="sohighthesky" date="" common="事件捕获"><![CDATA[<div id="div1" style="border:1px solid #09f;height:200px;width:200px" >外面的
<div id="div2" style="border:1px solid #09f;height:150px;width:150px">里面的</div></div>

<div id="div3" style="border:1px solid #09f;height:200px;width:200px" >外面的
<div id="div4" style="border:1px solid #09f;height:150px;width:150px">里面的</div></div>

<script type="text/javascript">
var $=function(){return document.getElementById(arguments[0])};
var msg=function(){alert(this.innerHTML);};
var isCapture=false;
$("div1").addEventListener("click",msg,isCapture);
$("div2").addEventListener("click",msg,isCapture);
var isCapture2=true;
$("div3").addEventListener("click",msg,isCapture2);
$("div4").addEventListener("click",msg,isCapture2);
</script>]]></capture><destroyInstance author="dh20156" date="" common="在类中实现实例的销毁方法"><![CDATA[<script type="text/javascript">

var o = function(){
    this.show = function(){alert('hahaha');};
    this.destroy = function(){delete this.show;delete this.destroy;this.valueof=this.toString=function(){return null;};};
};

var i = new o();
alert(i);
i.show();

i.destroy();
alert(i);
if(i){alert('虽然值为undefined，但转换为boolean值时确是true - -!');}

var b = i.toString();
alert(b);
if(b){alert('你将看不到这个alert消息，因为酱紫才能通过boolean的正确判断！');}

</script>]]></destroyInstance><MouseWheel author="Sheneyan" date="" common="鼠标滚轮事件"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MouseWheel</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function handleMouseWheel(e){
  if (!e) e = window.event;
  if (e.wheelDelta <= 0 || e.detail > 0) {document.getElementById('t').innerHTML='滚轮向下滚?'}
  else {document.getElementById('t').innerHTML='滚轮向上滚?'}
}
if(document.attachEvent||/(?:ie|webkit)/i.test(navigator.appVersion)){
      document.onmousewheel = handleMouseWheel;
}else{
      window.addEventListener("DOMMouseScroll", handleMouseWheel, false);
}
</script>
</head>
<body>
<div id="t">动动你的滚轮！！</div>
</body>
</html>]]></MouseWheel><findNearlyTag author="WC" date="" common="找指定的包含某具体值最近的标签"><![CDATA[<textarea id="t">
<div class="article_area">
  <div>article start</div>
  <div><h2>标题：www</h2></div>
  <div>article end</div>
</div> 
<div class="article_area">
  <div>article start</div>
  <div><h3>标题：www</h3></div>
  <div>article end</div>
</div> 
</textarea>

<script type="text/javascript">
var str = document.getElementById('t').value;
var r = /<div[^>]*>(?:(?!<\/?div)[\s\S])*标题：www[\s\S]*?<\/div>/ig;
var ret = str.match(r);
alert(ret);
</script>]]></findNearlyTag><FPS author="dh20156" date="" common="观察不同FPS下贝赛尔曲线运动频率"><![CDATA[<div id="x" style="position:absolute;left:100px;top:300px;font-size:50px;">●</div>
<div style="position:absolute;left:100px;top:300px;width:500px;height:1px;background:red;font-size:0;"></div>
<button onclick="show(10);">FPS:10</button>
<button onclick="show(20);">FPS:20</button>
<button onclick="show(30);">FPS:30</button>
<button onclick="show(40);">FPS:40</button>
<button onclick="show(50);">FPS:50</button>
<button onclick="show(60);">FPS:60</button>
<button onclick="show(70);">FPS:70</button>
<button onclick="show(80);">FPS:80</button>
<button onclick="show(90);">FPS:90</button>
<button onclick="show(100);">FPS:100</button>

<script type="text/javascript">
var dx = document.getElementById('x');
var bzr = function(t,p0,p1,p2){return (1-t) * (1-t) * p0 + 2 * t * (1-t) * p1 + t * t * p2;};
var show = function(fps){
    var px0 = 100,py0 = 300,px1 = 300,py1 = 100,px2 = 500,py2 = 300;
    var startTime = new Date(),lastTime = 0,timer = 1000/fps;
    var innerfoo = function(){
        var now = new Date(),delay = now - lastTime,t = (now-startTime)/1000,timer2 = timer;
        if(delay>timer2){timer2 = Math.max(1,timer2-(delay-timer2));}
        lastTime = now;
        var x = bzr(t,px0,px1,px2),y = bzr(t,py0,py1,py2);
        if((x!=px0||y!=py0)&&(x>px2&&y>py2)){return;}
        dx.style.left = x+'px';
        dx.style.top = y+'px';
        window.setTimeout(arguments.callee,timer2);
    };
    innerfoo();
};
</script>]]></FPS><FadeColor author="KB@OperaChina" date="" common="颜色渐变"><![CDATA[<html>
<head>
<title>The Yellow Fade Technique in pure JavaScript</title>
<style type="text/css">
body{background-color: blue;color: black;}
</style>
</head>
<body>
<h1>The Yellow Fade Technique in pure JavaScript</h1>
<p id="yft">Click the button to show the Yellow Fade Technique on this 
paragraph.</p>
<p><button>Fade</button></p>
<script>
YFT = {
    fade: function(element, startcolour, endcolour, time_elapsed) {
        var interval = 30;
        var steps = time_elapsed / interval;
        var red_change = (startcolour[0] - endcolour[0]) / steps;
        var green_change = (startcolour[1] - endcolour[1]) / steps;
        var blue_change = (startcolour[2] - endcolour[2]) / steps;
        var currentcolour = startcolour;
        var stepcount = 0;
        element.style.backgroundColor = 'rgb(' + currentcolour.toString() + ')';
        var timer = setInterval(function(){
            currentcolour[0] = parseInt(currentcolour[0] - red_change);
            currentcolour[1] = parseInt(currentcolour[1] - green_change);
            currentcolour[2] = parseInt(currentcolour[2] - blue_change);
            element.style.backgroundColor = 'rgb(' + currentcolour.toString() + ')';
            stepcount += 1;
            if (stepcount >= steps) {
                element.style.backgroundColor = 'rgb(' + endcolour.toString() + ')';
                clearInterval(timer);
            }
        }, interval);
    },
    click: function() {
        YFT.fade(document.getElementById("yft"), [255,255,60], [0,0,255], 750);
        return false;
    }
}
document.getElementsByTagName("button")[0].onclick = YFT.click;
</script>
</body>
</html>]]></FadeColor><JSTweener author="dh20156" date="" common="JSTweener翻屏效果"><![CDATA[<style type="text/css">
html,body{padding:0;margin:0;width:100%;height:100%;overflow:hidden;}
</style>
<div style="width:100%;height:100%;background:red;">Page 1 往下拖拽翻屏</div>
<div style="width:100%;height:100%;background:green;">Page 2 往上往下拖拽翻屏</div>
<div style="width:100%;height:100%;background:blue;">Page 3 往上拖拽翻屏</div>
<script type="text/javascript" src="http://www.easyui.org.cn/jstweener.js"></script>
<script type="text/javascript">
var bdown = false,bdrag = false,cy = 0,ih = parseInt(document.body.clientHeight);
document.body.onmousedown = function(e){e = e||window.event,cy = e.clientY,bdown = true;};
document.body.onmousemove = function(){if(bdown){bdrag = true;}};
document.body.onmouseup = function(e){
	e = e||window.event;
	if(bdrag){
		var increment = (e.clientY>cy)?(this.scrollTop+ih):(this.scrollTop-ih);
		JSTweener.addTween(this, {
			time: 0.5,
			transition: 'easeOutExpo',
			scrollTop: increment
		});
	}
	bdown = bdrag = false;
};
</script>]]></JSTweener><TryFinally author="winter" date="" common=""><![CDATA[<script type="text/javascript">
function sum(n){
    var i = 0, sum = 0;
    while(1){
        try{
            return sum;
        }finally{
            sum+=++i;
            if(i<=n){continue;}
        }
    }
}
alert(sum(100));

/*
The production TryStatement : try Block Finally is evaluated as follows:
1. Evaluate Block.
2. Evaluate Finally.
3. If Result(2) .type is normal, return Result(1).
4. Return Result(2).
break是break
continue是continue
throw是throw
return是return
其它的是normal
break continue throw return
它们又被称为abrupt completion
try其实也是一种控制结构,利用它能表达一些很奇怪的程序逻辑
从语义上try结构用来捕获异常,但是通过研究我们也许可以赋予它新的语义和使用方法
*/
</script>]]></TryFinally><DivisionByZero author="dh20156" date="" common="与0做除法的结果"><![CDATA[<script type="text/javascript">
alert(0/0);//NaN
alert(0/1);//0
alert(0/-1);//0
alert(1/0);//Infinity
alert(-1/0);//-Infinity
</script>]]></DivisionByZero><easyUTF8 author="dh20156" date="" common="GBK转UTF8"><![CDATA[<script type="text/javascript">
var easyUTF8 = function(gbk){
	if(!gbk){return '';}
	var utf8 = [];
	for(var i=0;i<gbk.length;i++){
		var s_str = gbk.charAt(i);
		if(!(/^%u/i.test(escape(s_str)))){utf8.push(s_str);continue;}
		var s_char = gbk.charCodeAt(i);
		var b_char = s_char.toString(2).split('');
		var c_char = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].concat(b_char).slice(-16);
		var a_b =[];
		a_b[0] = '1110'+c_char.splice(0,4).join('');
		a_b[1] = '10'+c_char.splice(0,6).join('');
		a_b[2] = '10'+c_char.splice(0,6).join('');
		for(var n=0;n<a_b.length;n++){
			utf8.push('%'+parseInt(a_b[n],2).toString(16).toUpperCase());
		}
	}
	return utf8.join('');
};
document.write('easyUTF8("我爱北京天安门！"):'+easyUTF8('我爱北京天安门！')+'<br/>');
document.write('encodeURI("我爱北京天安门！"):'+encodeURI('我爱北京天安门！'));
</script>]]></easyUTF8><command author="dh20156" date="" common="command模式实现undo,redo"><![CDATA[<style type="text/css">
div{border:3px solid black;padding:10px;}
</style>

<div id="x">初始值</div>

<script type="text/javascript">
//要应用command模式的对象
var box = function(dbox,svalue){
    this.value = svalue;
    this.dbox = dbox;
    this.restart = function(){//约定一个回到初始状态的方法
        this.value = svalue;
        this.dbox.innerHTML = svalue;
    };
};
box.prototype = {
    setValue:function(svalue){
        this.value = svalue;
        this.dbox.innerHTML = svalue;
    }
};
//command对象
var command = function(receiver){
    this.receiver = receiver;
    this.log = [];
    this.un_re_do = -1;
};
command.prototype = {
    query:function(cmd){
        if(!cmd||cmd.constructor!=Function){return;}
        var args = Array.prototype.slice.call(arguments,0);
        var idx = this.un_re_do+1,ll = this.log.length;
        if(ll){this.log.splice(idx,ll-idx);}
        this.log.push(args);
        this.un_re_do++;
        this.exec.apply(this,args);
    },
    exec:function(){
        var args = Array.prototype.slice.call(arguments,0);
        if(!args.length){return;}
        var cmd = args.shift();
        if(cmd.constructor!=Function){return;}
        cmd.apply(this.receiver,args);
    },
    undo:function(){
        var idx = (this.un_re_do>=0)?--this.un_re_do:-1;
        this.unredo(idx);
    },
    redo:function(){
        var idx = (this.un_re_do<this.log.length-1)?++this.un_re_do:this.un_re_do;
        this.unredo(idx);
    },
    unredo:function(idx){
        if(idx>=0){
            var cmd_step = this.log[idx];
            this.exec.apply(this,cmd_step);
        }else{
            this.receiver.restart();
        }
    }
};

var hellobox = new box(document.getElementById('x'),'初始值');
var boxCommand = new command(hellobox);

window.setTimeout(function(){boxCommand.query(hellobox.setValue,'第一次修改值！');},1000);
window.setTimeout(function(){boxCommand.undo();},2000);
window.setTimeout(function(){boxCommand.query(hellobox.setValue,'第二次修改值！');},3000);
window.setTimeout(function(){boxCommand.undo();},4000);
window.setTimeout(function(){boxCommand.redo();},5000);
window.setTimeout(function(){boxCommand.query(hellobox.setValue,'第三次修改值！');},6000);
window.setTimeout(function(){boxCommand.query(hellobox.setValue,'第四次修改值！');},7000);
window.setTimeout(function(){boxCommand.undo();},8000);
window.setTimeout(function(){boxCommand.undo();},9000);
window.setTimeout(function(){boxCommand.undo();},10000);
</script>]]></command><clearRepeat author="WC" date="" common="判断7组1到10个不重复数字"><![CDATA[<script type="text/javascript">
//判断以1开头，连续7组1到10个不重复数字
var a = '1 23 123 234 345';
var b = '1 23 123 234 345 456 567 6788';
var c = '1 123 234 345 456 567 678 789';
var r = /^1(?:\s(?:(\d)(?![^\s]*\1)){1,10}){7}$/;
alert(r.test(a));//false
alert(r.test(b));//false
alert(r.test(c));//true
</script>]]></clearRepeat><externalDataEval author="dh20156" date="" common="安全处理外部数据的eval操作"><![CDATA[<script type="text/javascript">

var hahaha = function(){alert('hahaha');return 'evil';};

var a = 'hahaha()';
var b = 'evil = (function(){alert("wahahaha");return "evil";})()';
var c = '</div><iframe src="http://www.easyui.org.cn"></iframe><div>';

var externalData = function(str){
	return str.replace(/(\()|\</g,function(a,b){return b?'&shy;(':'<&shy;';});
};
var externalEval = function(str){
	if(!str.length){return;}
	str = externalData(str);
	try{return eval('0,'+str);}catch(e){return str;}
};

var A = externalEval(a);
var B = externalEval(b);
var C = externalEval(c);

document.write('<div style="background:green;color:white;">Safe Eval() For External Data:<hr/>');
document.write(A+'<br/>');
document.write(B+'<br/>');
document.write(C+'<br/>');
document.write(typeof evil+'</div>');


var C = eval('0,'+a);
var D = eval('0,'+b);

document.write('<div style="background:red;">Native Eval() For External Data:<hr/>');
document.write(C+'<br/>');
document.write(D+'<br/>');
document.write(typeof evil+'</div>');

</script>]]></externalDataEval><Infix2Suffix author="dh20156" date="" common="中缀转后缀表达式(逆波兰式)及求值算法"><![CDATA[<script type="text/javascript">
//中缀表达式转后缀表达式
var ie2se = function(mExp){
	var exp2array = function(exp){
		var ret = [];
		exp.replace(/([^\d])|(\d*)/g,function(s,a,b){if(a){ret.push(a);}if(b){ret.push(b)}});
		return ret.slice(0);
	};
	//将中缀表达式打散为数组形式
	var remExp = exp2array(mExp);
	//运算符栈和数据栈
	var OS = [],DS = [];
	//换算运算符优先级
	var r = /(?:([+-])|([*\/])|([\(\)]))/;
	var getPRI = function(o){
		r.test(o);
		return RegExp.$2?1:RegExp.$3?2:0;
	};
	var tmpItem = null,OSTop = null,pti = 0,ptt = 0;
	while(remExp.length){
		//取剩余表达式中第一个元素
		tmpItem = remExp.shift();
		OSTop = OS[0];
		if(isNaN(tmpItem)){//运算符
			pti = getPRI(tmpItem);
			ptt = getPRI(OSTop);
			if(pti>ptt){//优先级高于OS[0]
				if(tmpItem!=')'){//运算符不是右括号
					OS.unshift(tmpItem);
				}else{
					DS.push(OS.shift());
					OS.shift();//丢掉'(';
				}
			}else{//优先级低于或等于OS[0]
				//循环判断，直至OS[0]优先级大于当前运算符
				while(OS.length&&OS[0]!='('&&pti<=getPRI(OS[0])){
					DS.push(OS.shift());
				}
				OS.unshift(tmpItem);
			}
		}else{//数据
			DS.push(tmpItem);
		}
	}
	//剩余表达式为空后，将OS栈的元素都push到DS栈
	while(OS.length){DS.push(OS.shift());}
	return DS.slice(0);
};

//后缀表达式求值
var suffix_compute = function(suffixExp){
	var ret = suffixExp.slice(0);
	while(ret.length>1){
		var idx = 0;//第一个运算符出现的位置
		for(var i=0;i<ret.length;i++){if(isNaN(ret[i])){idx = i-2;break;}}
		//取出该位置前及其前两个元素
		var a = ret.splice(idx,1);
		var b = ret.splice(idx,1);
		var o = ret.splice(idx,1);
		//计算
		var e = eval('('+a+')'+o+'('+b+')');
		//计算结果插入到该位置
		ret.splice(idx,0,e);
	}
	return ret[0];
};

var me = '3+4/(25-(6*5))*8';
var se = ie2se(me);
var d = suffix_compute(se);
document.write('<h3>中缀表达式转后缀表达式计算结果：</h3>'+me+' = '+eval(me)+'<br/>'+se+' = '+d);
</script>]]></Infix2Suffix><CatchMice author="zswang" date="" common=""><![CDATA[<html>
<head>
<title>盒子游戏</title>
<style type="text/css">
body{font-size:10pt;}
.table_back{width:300px;height:300px;}
.floor{border:1px solid black;cursor:pointer;}
.closed{background-color:#808080;cursor:default;}
.edge{border-color:#dfdfdf;}
.mickey{background:red;cursor:default;}
.spider{background:green;cursor:default;}
</style>
</head>
<body>
<script type="text/javascript">
/*--
标题：盒子游戏
设计：王集鹄
博客：http://blog.csdn.net/zswang
日期：2009年12月5日
--*/

function Box(options) {
    options = options || {};
    var self = this;
    this.rowCount = options.rowCount || 15; // 行数
    this.colCount = options.colCount || 15; // 列数
    this.closedCount = options.closedCount || 3; // 起始关闭数
    this.mickeyCount = options.mickeyCount || 1; // 老鼠的数量
    this.parent = options.parent || document.body; // 容器
    this.onnewmickey = options.onnewmickey; // 初始化老鼠的事件
    this.table_back = document.createElement("table");
    this.table_back.className = "table_back";
    this.table_back.border = 1;
    this.playing = false; // 是否在进行中
    this.floors = {}; // 矩阵地板矩阵 [y,x]
    for (var i = 0; i < this.rowCount; i++) {
        var tr = this.table_back.insertRow(-1);
        for (var j = 0; j < this.colCount; j++) {
            var td = tr.insertCell(-1);
            this.floors[i + "," + j] = new Floor({
                td: td
                , box: this
                , pos: { x: j, y: i }
            });
        }
    }

    this.mickeys = []; // 老鼠集合
    for (var i = 0; i < this.mickeyCount; i++) {
        var mickey = new Mickey({box: this});
        mickey.index = i;
        if (this.onnewmickey) this.onnewmickey(mickey);
        this.mickeys.push(mickey);
    }
    this.parent.appendChild(this.table_back);
}

// 重新开始
Box.prototype.replay = function () {
    this.playing = true;
    for (var i = 0; i < this.rowCount; i++) {
        for (var j = 0; j < this.colCount; j++) {
            this.floors[i + "," + j].setState("blank");
        }
    }
    for (var i = 0; i < this.closedCount; i++) {
        this.floors[
            Math.floor(this.rowCount * Math.random())
            + "," + Math.floor(this.colCount * Math.random())
        ].setState("closed");
    }
    var j = -(this.mickeys.length / 2);
    for (var i = 0; i < this.mickeys.length; i++, j++) {
        if (this.mickeys.length % 2 == 0 && i == this.mickeys.length / 2)
            j++;
        this.mickeys[i].move({
            x: Math.floor(this.colCount / 2)
            , y: Math.floor(this.rowCount / 2 + j)
        });
    }
}

// 下一个周期
Box.prototype.kick = function() {
    if (!this.playing) return;
    var count = 0;
    var freedom = false;
    for (var i = 0; i < this.mickeys.length; i++) {
        if (this.mickeys[i].run()) count++;
        if (this.mickeys[i].freedom) freedom = true;
    }
    if (freedom) // 有老鼠跑了
        this.gameover();
    else if (!count) this.win();
}

// 游戏结束
Box.prototype.gameover = function() {
    if (!this.playing) return;
    this.playing = false;
    if (this.ongameover) this.ongameover();
}

Box.prototype.win = function() {
    if (!this.playing) return;
    this.playing = false;
    if (this.onwin) this.onwin();
}

// 地板
function Floor(options) {
    options = options || {};
    var self = this;
    this.td = options.td || {};
    this.td.innerHTML = "&nbsp;";
    this.td.onclick = function() {
        if (!self.box.playing) return; // 游戏已经结束
        if (self.state != "blank") return;
        self.setState("closed");
        self.box.kick();
    }
    this.box = options.box || {};
    this.pos = options.pos || {};
    this.state = "blank";
    this.doChange();
}

// 状态变化
Floor.prototype.doChange = function() {
    var className = "floor";
    if (this.pos.x * this.pos.y == 0
        || this.pos.x == this.box.colCount - 1
        || this.pos.y == this.box.rowCount - 1) // 边缘
        className += " edge";
    className += " " + this.state;
    if (this.td.className != className)
        this.td.className = className;
}

Floor.prototype.setState = function(state) {
    if (this.state == state) return;
    this.state = state;
    if (this.box.next) this.box.next();
    this.doChange();
}

// 老鼠类
function Mickey(options) {
    options = options || {};
    this.box = options.box || {};
    this.route = null; // 逃跑路线
    this.pos = {}; // 所在位置
    this.move(this.pos);
    this.freedom = false;
    this.name = "mickey";
    this.offsets = [ // 移动规则
        {x: -1, y: 0}
        , {x: 0, y: -1}
        , {x: +1, y: 0}
        , {x: 0, y: +1}
    ];
}

// 移动位置
Mickey.prototype.move = function(pos) {
    pos = pos || {};
    if (pos.x == this.x && pos.y == this.y) return;
    if (this.box.floors[this.pos.y + "," + this.pos.x])
        this.box.floors[this.pos.y + "," + this.pos.x].setState("blank");
    this.pos = pos;
    this.box.floors[this.pos.y + "," + this.pos.x].setState(this.name);
    this.freedom = this.pos.x == 0 || this.pos.y == 0 
        || this.pos.x == this.box.colCount - 1
        || this.pos.y == this.box.rowCount - 1;
}

// 老鼠跑
Mickey.prototype.run = function() {
    var directions = { route: [], pos: this.pos };
    this.flags = {};
    this.route = [];
    if (this.search(this.pos, this.route)) {
        this.move(this.route.shift());
        return true;
    }
}

// 搜索逃跑路径
Mickey.prototype.search = function(pos, route) {
    if (this.flags[pos.y + "," + pos.x]) return false;
    this.flags[pos.y + "," + pos.x] = true; // 标记已经扫描

    // 搜索直观的路径
    var directions = {}; // 每个方向的路径
    var min = -1; // 最短的距离
    for (var i = 0; i < this.offsets.length; i++) {
        directions[i] = [];
        for (var j = 1; ; j++) {
            var test = {
                x: pos.x + this.offsets[i].x * j
                , y: pos.y + this.offsets[i].y * j
            };
            if (!(test.x >= 0 && test.y >= 0
                && test.x < this.box.colCount && test.y < this.box.rowCount 
                && !this.flags[test.y + "," + test.x] // 未搜索过
                && this.box.floors[test.y + "," + test.x].state == "blank")) {
                directions[i] = [];
                break;
            }
            directions[i].push(test);
            if (test.x == 0 || test.y == 0
                || test.x == this.box.colCount - 1
                || test.y == this.box.rowCount -1) {
                if (min < 0 || directions[min].length > directions[i].length) min = i;
                break;
            }
        }
    }
    if (min >= 0) {
        for (var i = 0; i < directions[min].length; i++)
            route.push(directions[min][i]);
        return true;
    }

    // 回溯搜索
    var k = Math.floor(Math.random() * this.offsets.length);
    for (var i = 0; i < this.offsets.length; i++) {
        var test = {
            x: pos.x + this.offsets[(k + i) % this.offsets.length].x
            , y: pos.y + this.offsets[(k + i) % this.offsets.length].y
        };
        if (test.x >= 0 && test.y >= 0
            && test.x < this.box.colCount && test.y < this.box.rowCount 
            && !this.flags[test.y + "," + test.x] // 未搜索过
            && this.box.floors[test.y + "," + test.x].state == "blank") { // 非空地
            route.push(test);
            if (test.x == 0 || test.y == 0
                || test.x == this.box.colCount - 1
                || test.y == this.box.rowCount -1)
                return true;
            if (this.search(test, route)) return true;
            route.pop();
        }
    }
    return false;
}

var button = document.createElement("input");
button.type = "button";
button.value = "第一关";
button.onclick = function() { 
    box1.replay(); 
};
document.body.appendChild(button);

var box1 = new Box();
box1.replay();

var button = document.createElement("input");
button.type = "button";
button.value = "第二关";
button.onclick = function() { 
    box2.replay(); 
};
document.body.appendChild(button);

var box2 = new Box({mickeyCount: 2});

box2.replay();

var button = document.createElement("input");
button.type = "button";
button.value = "第三关";
button.onclick = function() { 
    box3.replay(); 
};
document.body.appendChild(button);
var box3 = new Box({
    onnewmickey: function(mickey) {
        mickey.offsets = [
            {x: -1, y: 0}
            , {x: 0, y: -1}
            , {x: +1, y: 0}
            , {x: 0, y: +1}
            , {x: -1, y: +1}
            , {x: -1, y: -1}
            , {x: +1, y: -1}
            , {x: +1, y: +1}
        ];
        mickey.name = 'spider';
    }
});

box3.replay();
box1.ongameover = box2.ongameover = box3.ongameover = function() {
    alert("跑掉了。o(╯□╰)o");
}
box1.onwin = box2.onwin = box3.onwin = function() {
    alert("O(∩_∩)O成功！");
}
</script>
</body>
</html>]]></CatchMice><PichOnDom author="wangys0927" date="" common="选中DOM元素"><![CDATA[<html>
    <head></head>
    <style>
        body{padding-top:50px;padding-left:100px;padding-right:150px;}
        .fileDiv{float:left;width:100px;height:100px;text-align:center;line-height:100px;font-size:12px;border:1px solid #cccccc;margin-right:10px;margin-bottom:10px;}
        .seled{border:1px solid #ff0000;background-color:#D6DFF7;}    
		table{margin-top:50px;border-collapse:collapse;border-spacing:0;width:100%;}
		td{overflow:hidden;white-space:nowrap;}
</style>
    <script type="text/javascript">
/*--------------------------------- 以下4个方法 摘自网络 ----------------------------------------*/
Array.prototype.remove = function( item ){
        for( var i = 0 ; i < this.length ; i++ ){
            if( item == this[i] )
                break;
        }
        if( i == this.length )
            return;
        for( var j = i ; j < this.length - 1 ; j++ ){
            this[ j ] = this[ j + 1 ];
        }
        this.length--;
     }    
    
String.prototype.replaceAll = function (AFindText,ARepText){ raRegExp = new RegExp(AFindText,"g"); return this.replace(raRegExp,ARepText);}
    
function getAllChildren(e) {
return e.all ? e.all : e.getElementsByTagName('*');
}

document.getElementsBySelector = function(selector) {

if (!document.getElementsByTagName) {
return new Array();
}

var tokens = selector.split(' ');
var currentContext = new Array(document);
for (var i = 0; i < tokens.length; i++) {
token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;
if (token.indexOf('#') > -1) {

var bits = token.split('#');
var tagName = bits[0];
var id = bits[1];
var element = document.getElementById(id);
if (tagName && element.nodeName.toLowerCase() != tagName) {

return new Array();
}
currentContext = new Array(element);
continue;
}
if (token.indexOf('.') > -1) {

var bits = token.split('.');
var tagName = bits[0];
var className = bits[1];
if (!tagName) {
tagName = '*';
}

var found = new Array;
var foundCount = 0;
for (var h = 0; h < currentContext.length; h++) {
var elements;
if (tagName == '*') {
elements = getAllChildren(currentContext[h]);
} else {
elements = currentContext[h].getElementsByTagName(tagName);
}
for (var j = 0; j < elements.length; j++) {
found[foundCount++] = elements[j];
}
}
currentContext = new Array;
var currentContextIndex = 0;
for (var k = 0; k < found.length; k++) {
if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
currentContext[currentContextIndex++] = found[k];
}
}
continue;
}
if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
var tagName = RegExp.$1;
var attrName = RegExp.$2;
var attrOperator = RegExp.$3;
var attrValue = RegExp.$4;
if (!tagName) {
tagName = '*';
}
var found = new Array;
var foundCount = 0;
for (var h = 0; h < currentContext.length; h++) {
var elements;
if (tagName == '*') {
elements = getAllChildren(currentContext[h]);
} else {
elements = currentContext[h].getElementsByTagName(tagName);
}
for (var j = 0; j < elements.length; j++) {
found[foundCount++] = elements[j];
}
}
currentContext = new Array;
var currentContextIndex = 0;
var checkFunction;
switch (attrOperator) {
case '=':
checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
break;
case '~':
checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
break;
case '|':
checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
break;
case '^':
checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
break;
case '$':
checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
break;
case '*':
checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
break;
default :
checkFunction = function(e) { return e.getAttribute(attrName); };
}
currentContext = new Array;
var currentContextIndex = 0;
for (var k = 0; k < found.length; k++) {
if (checkFunction(found[k])) {
currentContext[currentContextIndex++] = found[k];
}
}
continue;
}
tagName = token;
var found = new Array;
var foundCount = 0;
for (var h = 0; h < currentContext.length; h++) {
var elements = currentContext[h].getElementsByTagName(tagName);
for (var j = 0; j < elements.length; j++) {
found[foundCount++] = elements[j];
}
}
currentContext = found;
}
return currentContext;
}

    
/*--------------------------------------------------------------------------------------------------------*/
/**
* author: 王永山
* version: 1.1 beta
* date: 2008-09-09
* email: [email]wangys0927@163.com[/email]
*
* update:
* 1. 针对前2个beta版，该版本修复了前两个版本出现的 bug ，
* 2. 进行了代码的简单封装（由于本人初学js，对js掌握的很浅，因此面向对象的理解很差，封装的不好）；
* 3. 增加了对 Ctrl 和 Shift 键的支持(目前shift键的功能和ctrl键的功能一样，还不能达到仿windows的选区Shift键的功能)。
* 4. 增加了获取“被选区选中元素”的方法，可以点击按钮“getRegions”看效果。
*/


function addEvent(eventType,eventFunc,eventObj){
     eventObj = eventObj || document;
     if(window.attachEvent) eventObj.attachEvent("on"+eventType,eventFunc);
if(window.addEventListener) eventObj.addEventListener(eventType,eventFunc,false);
}
function clearEventBubble(evt){
         evt = evt || window.event;
     if (evt.stopPropagation) evt.stopPropagation(); else evt.cancelBubble = true;
if (evt.preventDefault) evt.preventDefault(); else evt.returnValue = false;
}
    
function posXY(event){
    event = event || window.event;
var posX = event.pageX || (event.clientX +
            (document.documentElement.scrollLeft || document.body.scrollLeft));
var posY = event.pageY || (event.clientY +
            (document.documentElement.scrollTop || document.body.scrollTop));
return {x:posX, y:posY};
}
//----------- 区域选择关键方法 -----------------------
    var _selectedRegions = [];
    function RegionSelect(selRegionProp){
         this.regions =[];
         var _regions = document.getElementsBySelector(selRegionProp["region"]);
         if(_regions && _regions.length > 0){
             var _self = this;
              for(var i=0; i< _regions.length;i++){
                      _regions[i].onmousedown = function(){
                              var evt = window.event || arguments[0];
                              if(!evt.shiftKey && !evt.ctrlKey){
                                  // 清空所有select样式
                                  _self.clearSelections(_regions);
                                  this.className += " "+_self.selectedClass;
                                  // 清空selected数组，并加入当前select中的元素
                                  _selectedRegions = [];
                                  _selectedRegions.push(this);
                              }else{
                                  if(this.className.indexOf(_self.selectedClass) == -1){
                                          this.className += " "+_self.selectedClass;
                                          _selectedRegions.push(this);
                                  }else{
                                       this.className = this.className.replaceAll(_self.selectedClass,"");
                                       _selectedRegions.remove(this);
                                  }
                              }
                              clearEventBubble(evt);
                      }
                      this.regions.push(_regions[i]);
              }
         }
         this.selectedClass = selRegionProp["selectedClass"];
         this.selectedRegion = [];
         this.selectDiv = null;
         this.startX = null;
         this.startY = null;
    }
    
    RegionSelect.prototype.select = function(){
        var _self = this;
        addEvent("mousedown",function(){
                var evt = window.event || arguments[0];
                _self.onBeforeSelect(evt);
                clearEventBubble(evt);
        },document);
        
        addEvent("mousemove",function(){
                var evt = window.event || arguments[0];
                _self.onSelect(evt);
                clearEventBubble(evt);
        },document);
        
        addEvent("mouseup",function(){
                _self.onEnd();
        },document);
    }
    
    RegionSelect.prototype.onBeforeSelect = function(evt){
         // 创建模拟 选择框
        if(!document.getElementById("selContainer")){
             this.selectDiv = document.createElement("div");
             this.selectDiv.style.cssText = "position:absolute;width:0px;height:0px;font-size:0px;margin:0px;padding:0px;border:1px dashed #0099FF;background-color:#C3D5ED;z-index:1000;filter:alpha(opacity:60);opacity:0.6;display:none;";
             this.selectDiv.id = "selContainer";
             document.body.appendChild(this.selectDiv);
    }else{
         this.selectDiv = document.getElementById("selContainer");
    }
    
    this.startX = posXY(evt).x;
    this.startY = posXY(evt).y;
    this.isSelect = true;
    
    }
    
    RegionSelect.prototype.onSelect = function(evt){
         var _self = this;
         if(_self.isSelect){
              if(_self.selectDiv.style.display == "none") _self.selectDiv.style.display = "";
              
          var posX = posXY(evt).x;
          var poxY = posXY(evt).y;
         
			 _self.selectDiv.style.left = Math.min(posX, this.startX);
             _self.selectDiv.style.top = Math.min(poxY, this.startY);
             _self.selectDiv.style.width = Math.abs(posX - this.startX);
             _self.selectDiv.style.height = Math.abs(poxY - this.startY);    
             
             var regionList = _self.regions,l = regionList.length;
             for(var i=0; i< l; i++){
                  var r = regionList[i], sr = _self.innerRegion(_self.selectDiv,r);
                  if(sr && r.className.indexOf(_self.selectedClass) == -1){
                       r.className = r.className + " "+_self.selectedClass;    
                       _selectedRegions.push(r);
                  }else if(!sr && r.className.indexOf(_self.selectedClass) != -1){
                       r.className = r.className.replaceAll(_self.selectedClass,"");
                       _selectedRegions.remove(r);
                      }
                 
             }
    }
    }
    
    RegionSelect.prototype.onEnd = function(){
        if(this.selectDiv){
             this.selectDiv.style.display = "none";    
        }
        this.isSelect = false;
        //_selectedRegions = this.selectedRegion;
    }
	
	//判断DOM对象位置 by dh20156
	RegionSelect.prototype.getPos = function(obj){
		var top=0;
		var left=0;
		var width=obj.offsetWidth;
		var height=obj.offsetHeight;
		while (obj.offsetParent) {
			top += obj.offsetTop;
			left += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		return {"top":top,"left":left,"width":width,"height":height};
	}
    
    // 判断一个区域是否在选择区内
    RegionSelect.prototype.innerRegion = function(selDiv, region){
         var s_top = parseInt(selDiv.style.top);
         var s_left = parseInt(selDiv.style.left);
         var s_right = s_left + parseInt(selDiv.offsetWidth);
         var s_bottom = s_top + parseInt(selDiv.offsetHeight);
        
		 //一定要酱紫才能得到正确的位置 by dh20156
		 var r_pos = this.getPos(region);
		
         var r_top = parseInt(r_pos.top);
         var r_left = parseInt(r_pos.left);
         var r_right = r_left + parseInt(r_pos.width);
         var r_bottom = r_top + parseInt(r_pos.height);
		 
		 var by1 = (s_top<r_top&&s_top>r_bottom)?true:false;
		 var by2 = (s_bottom>r_top&&s_top<r_bottom)?true:false;
		 var bx1 = (s_left>r_left&&s_left<r_right)?true:false;
		 var bx2 = (s_right>r_left&&s_right<r_right)?true:false;
		 
		 return (by1&&bx1||by1&&bx2||by2&&bx1||by2&&bx2)?region:null;
    }
    
    RegionSelect.prototype.clearSelections = function(regions){
        for(var i=0; i<regions.length;i++){
		with({i:i}){
            regions[i].className = regions[i].className.replaceAll(this.selectedClass,"");
        }}
		
    }
    
    function getSelectedRegions(){
        return     _selectedRegions;
    }
/*-------------------------------------- 区域选择方法结束 --------------------------------------------*/
    
    function showSelDiv(){
         var selInfo = "";
         var arr = getSelectedRegions();
         for(var i=0; i<arr.length;i++){
                   selInfo += arr[i].innerHTML+"\n";
         }

         alert("共选择 "+arr.length+" 个文件，分别是：\n"+selInfo);
        
    }
    
        </script>    
    <body>
<button onclick="showSelDiv();">getRegions</button>

<div class="fileDiv2">A</div>
<div class="fileDiv2">B</div>
<div class="fileDiv2">C</div>

<table>
    <tr><td><div class="fileDiv2">1</div></td></tr>
    <tr><td><div class="fileDiv2">2</div></td></tr>
	<tr><td><div class="fileDiv2">3</div></td></tr>
</table>

    </body>    
    <script>
new RegionSelect({
    region:'div.fileDiv2',
    selectedClass: 'seled'
}).select();
    </script>
</html>]]></PichOnDom><WhatIsThis author="dh20156" date="" common="this始终指向到调用它胡对象"><![CDATA[<script type="text/javascript">
/*注意观察不同浏览器下的结果*/
var whatisthis = function(){
    alert('typeof:\n'+typeof(this)+'\n\nObject.prototype.toString.call:\n'+Object.prototype.toString.call(this)+'\n\nconstructor:\n'+this.constructor);
};

whatisthis();

var b = new whatisthis();

var c = function(){};
whatisthis.call(c);
</script>]]></WhatIsThis><inherit author="dh20156" date="" common="基于原型深复制的继承"><![CDATA[<script type="text/javascript">
//深复制
var deepClone = function(source){
	if(source===null){return null;}
	if(source===undefined){return undefined;}
	if(typeof(source)!='object'){return source;}
	if(source.constructor==Array){
		var ret = [];
		for(var i=0;i<source.length;i++){ret[i] = arguments.callee(source[i]);}
	}else{
		var ret = {};
		for(var d in source){ret[d] = arguments.callee(source[d]);}
	}
	return ret;
};
//原型复制
var extend = function(){
	var ret = {},p = {},args = Array.prototype.slice.call(arguments,0);
	while(args.length){
		p = deepClone(args.shift().prototype);//如果不用深复制，则替换为p = args.shift().prototype;
		for(var d in p){ret[d] = p[d];}
	}
	return ret;
};

//class a
var a = function(){};
a.prototype = (function(){
	var name = 'ap';//static variable,will be share via closure
	return {
		showcolor:function(){alert(this.color);},
		setname:function(sname){name = sname;},
		showname:function(){alert(name);}
	};
})()

//class b
var b = function(){};
b.prototype = {
	showpalate:function(){alert(this.palate);},
	util:{
		foo:function(){alert('util.foo');}
	}
};

//class c 继承 a,b
var c = function(scolor,spalate){
	//如果要进行属性继承，则按实际情况进行call或apply
	this.color = scolor||'red';
	this.palate = spalate||'sweet';
};
c.prototype = extend(a,b);

var ia = new c();
ia.showcolor();
ia.showpalate();
ia.setname('ia');
ia.showname();
ia.util.foo();

b.prototype.util.foo = null;//如果不使用深复制，ib.util.foo将无法执行

var ib = new c('green','acid');
ib.showcolor();
ib.showpalate();
ib.showname();
ib.util.foo();
</script>]]></inherit><charset author="dh20156" date="" common="unicode二进制十六进制转换"><![CDATA[<script type="text/javascript">
var su = '【W3C小组】';
var sh = '30100057003300435c0f7ec43011';
var sb = '0011000000010000000000000101011100000000001100110000000001000011010111000000111101111110110001000011000000010001';
var b2u = function(data,byte){
	byte = isNaN(byte)?16:byte||16;
	var r = new RegExp('\\d{'+byte+'}','g'),a = data.match(r),l = a.length,ret = [];
	for(var i=0;i<l;i++){
		var t = parseInt(a[i],2);
		ret.push(String.fromCharCode(t));
	}
	return ret.join('');
};

var u2b = function(data,byte){
	byte = isNaN(byte)?16:byte||16;
	var a = data.split(''),ret = [];
	for(var i=0;i<a.length;i++){
		var t = a[i].charCodeAt(0).toString(2).split('');
		t = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].concat(t).slice(0-byte);
		ret.push(t.join(''));
	}
	return ret.join('');
};

var h2u = function(data,byte){
	byte = isNaN(byte)?4:byte||4;
	var r = new RegExp('.{'+byte+'}','g'),a = data.match(r),l = a.length,ret = [];
	for(var i=0;i<l;i++){
		var t = parseInt(a[i],16);
		ret.push(String.fromCharCode(t));
	}
	return ret.join('');
};

var u2h = function(data,byte){
	byte = isNaN(byte)?4:byte||4;
	var a = data.split(''),ret = [];
	for(var i=0;i<a.length;i++){
		var t = a[i].charCodeAt(0).toString(16).split('');
		t = [0,0,0,0].concat(t).slice(0-byte);
		ret.push(t.join(''));
	}
	return ret.join('');
};

prompt('二进制转Unicode：\n'+sb,b2u(sb));
prompt('Unicode转二进制：\n'+su,u2b(su));
prompt('十六进制转Unicode：\n'+sh,h2u(sh));
prompt('Unicode转十六进制：\n'+su,u2h(su));
</script>]]></charset><ArrayMerge author="dh20156" date="" common="合并两个相同排序的数组"><![CDATA[<script type="text/javascript">
var a = [-3,-1,0,1,3,5,7,9],b = [-4,-2,0,2,3,4,5,6,7,8];

var merge = function(a,b){//a,b同时以A-Z排序后合并两数组
    if(!a||!a.length){return b&&b.length?b:null;}
    if(!b||!b.length){return a&&a.length?a:null;}
    var ret = [],min;
    while(a.length){
        if(!b.length){Array.prototype.push.apply(ret,a);break;}
        min = a[0]<b[0]?a.shift():b.shift();
        ret.push(min);
    }
    if(b.length){Array.prototype.push.apply(ret,b);}
    return ret.slice(0);
};

document.write(merge(a,b));
</script>]]></ArrayMerge><Bresenham author="dh20156" date="" common="Bresenham直线,圆,椭圆算法"><![CDATA[<body>
<script type="text/javascript">
var createPoint = function(x,y,c){
    if(isNaN(x)||isNaN(y)){return;}
    c = c||'#000000';
    var dp = document.createElement('div');
    dp.style.cssText = 'position:absolute;left:'+x+'px;top:'+y+'px;background:'+c+';width:1px;height:1px;overflow:hidden;';
    document.body.appendChild(dp);
}
var draw = function(list){
    if(!list||!list.length){return;}
	while(list.length){createPoint.apply(null,list.shift());}
};
/*Bresenham图形算法JavaScript版本By dh20156*/
/*画圆*/
var arc = function(x0,y0,r){/*起点坐标x0,y0,半径*/
	var p,x,y,i,ret = [];
	p = 3-2*r,x = 0,y = r,i = r;
	for(;x<=y;){
		ret.push([x+i+x0,y+i+y0]);
		ret.push([-x+i+x0,-y+i+y0]);
		ret.push([-x+i+x0,y+i+y0]);
		ret.push([x+i+x0,-y+i+y0]);
		ret.push([y+i+x0,x+i+y0]);
		ret.push([-y+i+x0,x+i+y0]);
		ret.push([-y+i+x0,-x+i+y0]);
		ret.push([y+i+x0,-x+i+y0]);
		if(p<0){
			p = p+4*x+6;
		}else{
			y--,p = p+4*(x-y)+10;
		}
		x++;
	}
	return ret.slice(0);
};
/*画椭圆*/
var ellipse = function(px,py,rx,ry){/*起点坐标px,py,x轴半径rx,y轴半径ry*/
	px = px+rx,py = py+ry;
	var x = 0,y = ry,rx2 = rx*rx,ry2 = ry*ry,ret = [];
	var dx = ry2/Math.sqrt(ry2+rx2),p = ry2-rx2*ry;
	while(dx<=y){
		ret.push([px+x,py+y]);
		ret.push([px+x,py-y]);
		ret.push([px-x,py+y]);
		ret.push([px-x,py-y]);
		if(p<=0){
			++x;
		}else{
			++x,--y;
		}
		p = ry2*(x+1)*(x+1)+rx2*(y*y-y)-rx2*ry2;
	}
	p = ry2*(x*x+x)+rx2*(y*y-y)-rx2*ry2;
	while(y>0){
		ret.push([px+x,py+y]);
		ret.push([px+x,py-y]);
		ret.push([px-x,py+y]);
		ret.push([px-x,py-y]);
		if(p>=0){
			--y,p = p-2*rx2*y-rx2;
		}else{
			--y,++x,p = p-2*rx2*y-rx2+2*ry2*x+2*ry2;
		}
	}
	ret.push([px+x,py]);
	ret.push([px-x,py]);
	return ret.slice(0);
};
/*画直线*/
var line = function(x1,y1,x2,y2){/*起点坐标x1,y1,终点坐标x2,y2*/
	var dx,dy,h,x,y,t,ret = [];
	if(x1>x2){x1 = [x2,x2=x1][0],y1 = [y2,y2=y1][0];}
	dx = x2-x1,dy = y2-y1,x = x1,y = y1;
	if(!dx){
		t = (y1>y2)?-1:1;
		while(y!=y2){ret.push([x,y]);y += t;}
		return ret.slice(0);
	}
	if(!dy){
		while(x!=x2){ret.push([x,y]);x++;}
		return ret.slice(0);
	}
	if(dy>0){
		if(dy<=dx){
			h = 2*dy-dx,ret.push([x,y]);
			while(x!=x2){
				if(h<0){
					h += 2*dy;
				}else{
					y++,h += 2*(dy-dx);
				}
				x++,ret.push([x,y]);
			}
		}else{
			h = 2*dx-dy,ret.push([x,y]);
			while(y!=y2){
				if(h<0){
					h += 2*dx;
				}else{
					++x,h += 2*(dx-dy);
				}
				y++,ret.push([x,y]);
			}
		}
	}else{
		t = -dy;
		if(t<=dx){
			h = 2*dy+dx,ret.push([x,y]);
			while(x!=x2){
				if(h<0){
					h += 2*(dy+dx),y--;
				}else{
					h += 2*dy;
				}
				x++,ret.push([x,y]);
			}
		}else{
			dy = -dy,dx = -dx,y = y2,x = x2,ret.push([x,y]),h = 2*dx+dy;
			while(y!=y1){
				if(h<0){
					h += 2*(dx+dy),x--;
				}else{
					h += 2*dx;
				}
				y++,ret.push([x,y]);
			}
		}
	}
	return ret.slice(0);
};
/*鼠标在窗体中单击后拖动测试结果*/
/*起点*/
var op = [0,0];
document.onmousedown = function(e){
	e=e||window.event;
	var x1 = e.clientX,y1 = e.clientY;
	op = [x1,y1];
}
document.onmouseup = function(e){
	e=e||window.event;
	var x0 = op[0],y0 = op[1];
	var x1 = e.clientX,y1 = e.clientY;
	/*画矩形和对角线*/
	var rect = [];
	Array.prototype.push.apply(rect,line(x0,y0,x1,y0));
	Array.prototype.push.apply(rect,line(x0,y0,x0,y1));
	Array.prototype.push.apply(rect,line(x0,y1,x1,y1));
	Array.prototype.push.apply(rect,line(x1,y0,x1,y1));
	Array.prototype.push.apply(rect,line(x0,y0,x1,y1));
	draw(rect);
	/*半径*/
	var r = parseInt(line(x0,y0,x1,y1).length/2);
	/*椭圆X轴半径，Y轴半径*/
	var rx = Math.ceil(Math.abs(x0-x1)/2),ry = Math.ceil(Math.abs(y0-y1)/2);
	/*修正另外3个象限的坐标*/
	if(x1>x0&&y1<=y0){y0 = y1;}
	if(x1<x0&&y1>=y0){x0 = x1;}
	if(x1<x0&&y1<y0){x0 = x1,y0 = y1;}
	/*画圆*/
	var aarc = arc(x0,y0,r);
	draw(aarc);
	/*画椭圆*/
	var aellipse = ellipse(x0,y0,rx,ry);
	draw(aellipse);
};
</script>
</body>]]></Bresenham><easyChange author="dh20156" date="" common="兼容处理input控件值改变事件"><![CDATA[<h1>兼容处理input控件值改变事件</h1>
<dl>
<dt>兼容处理：</dt>
<dd>手动输入事件捕获：手动输入内容时会触发</dd>
<dd>复制粘贴事件捕获：复制粘贴内容时会触发</dd>
<dd>程序设置事件捕获：javascript程序动态设置内容时会触发</dd>
<dd>拖入事件捕获：选定内容拖入时会触发</dd>
</dl>
<input type="text" id="x">
<label id="lbl">label</label>
<button>设置input值</button>
<script type="text/javascript">
var dlbl = document.getElementById('lbl'),dbtn = document.getElementsByTagName('button')[0];

var setLabel = function(svalue){dlbl.innerHTML = svalue;};

var easychange = function(foochange){
    if(!foochange||foochange.constructor!=Function){return;}
    try{this.watch("value",function(id,oldval,newval){foochange(newval);return newval;});}catch(e){}
    this.setAttribute('oninput','('+foochange.toString()+')(this.value)');
    this.onpropertychange = function(){foochange(this.value);};
    this.onmouseover = function(){foochange(this.value);};
    this.onkeyup = function(){foochange(this.value);};
};

var dx = document.getElementById('x');
easychange.call(dx,setLabel);
dx.value = 'hello';
dbtn.onclick = function(){dx.value = 'btn set ...';};
</script>]]></easyChange><isHTMLElement author="dh20156" date="" common="判断是否是HTML节点对象"><![CDATA[<div>a</div>
<script type="text/javascript">
var dc = document.getElementsByTagName('div');
var f = function(s){
    alert(typeof s);
    try{s.nodeType=1;}catch(e){alert(e.message);}
};
f();
f('f');
f(1);
f([]);
f(new Date());
f({nodeType:2});
f(true);
f(function(){});
f(dc);
f(dc[0]);
f(document.body);
</script>]]></isHTMLElement><dirTTB author="cshbl" date="" common="竖文转换"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head profile="http://gmpg.org/xfn/11">
<title>基于JavaScript技术的 竖文 转换工具</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="很好很神奇,转自：http://www.cshbl.com/gushu.html,把横排文字转成古典竖排文字的小工具。直接粘贴转换结果到论坛、博客等，可以以古书的形式显示，发扬中华文化，增加阅读写作趣味。">
<meta name="keywords" content="竖排 竖文 竖文运动 竖文转换 树文">
<style type="text/css">
p, body{
    font-size: 12px;
    line-height: 16px;
}
h1{
    text-align: center;
    font-size: 14px;
    padding: 4px 0px 4px 0px;
    margin: 0px;
}
#portrait-desc{
    float: right;
}
#content{
    width: 960px;
    padding-left: auto;
    padding-right: auto;
}
#portrait-desc pre{
    font-size: 12px;
    line-height: 12px;
    padding: 0px;
    margin: 0px;
}
#t, #s{
    width: 760px;
    padding: 0px;
    margin: 0px;
    font-size: 12px;
    line-height: 12px;
}
#links{
    float: right;
}
#source{
    margin-top: 20px;
}
#actions{
    margin-top: 20px;
}
#target{
    margin-top: 20px;
}
.comment{
    color: #330099;
    font-size:14px;
    margin:8px 0;
}
.commentforcustomer{
    padding-left: 10px;
    color: #857D7A;
}    
.convertbutton{
    font-size: 24px;
    font-weight: bold;
}
#copyright{
    margin:10px; padding:10px; border:1px solid #ccc; width:500px; background:#ffe;
}
#customerwords{
    margin-top: 20px;
}
#customerwords ul{
}
#customerwords li{
    
}
#authorwords{
    margin-top: 20px;
}
</style>
<script>
var tblChars = [['┏','┓','┗','┛','┯','┷','┃','│', '━'],
                ['╔','╗','╚','╝','╤','╧','║','│', '═'],
                ['┌','┐','└','┘','┬','┴','│','┆', '─'],
                [' ',' ',' ',' ',' ',' ',' ',' ',  ' '],
                ['','','','','','','│','│', ''],];

var tblTemplet = 1;
var blankChar = '　';
var width=20;
var height=8;
function convert(){
    var s = document.getElementById("s").value.toString();
    s = s.replace(/\r/g, "");
    if(s.length == 0){
        document.getElementById("s").focus();
        alert("请首先输入要转换格式的文字。");
        return;
    }
    var ary = [];
    var i,j, index;
    var t = "";
    index = 0;
    width = document.getElementById("x").value * 1;
    height = document.getElementById("y").value * 1;
    tblTemplet = document.getElementById("tbl").value * 1;
    
    for(i=width*2; i>=0; i--){
        ary[i] = new Array();
    }
    while(index < s.length){
        for(i=width*2; i>=0; i--){
            for(j=0; j<=(height+1); j++){
                if( i == (width * 2)){
                    if(j==0){
                        ary[i][j] = tblChars[tblTemplet][1];
                    }else if(j == (height + 1)){
                        ary[i][j] = tblChars[tblTemplet][3];
                    }else{
                        ary[i][j] = tblChars[tblTemplet][6];
                    }
                }else if( i== 0){
                    if(j==0){
                        ary[i][j] = tblChars[tblTemplet][0];
                    }else if(j == (height + 1)){
                        ary[i][j] = tblChars[tblTemplet][2];
                    }else{
                        ary[i][j] = tblChars[tblTemplet][6];
                    }
                }else if( i % 2 == 0){
                    if(j==0){
                        ary[i][j] = tblChars[tblTemplet][4];
                    }else if(j == (height + 1)){
                        ary[i][j] = tblChars[tblTemplet][5];
                    }else{
                        ary[i][j] = tblChars[tblTemplet][7];
                    }
                }else if(j == 0 || j == (height + 1)){
                    ary[i][j] = tblChars[tblTemplet][8];
                }else{
                    var c = getChar(s, index++);
                    if (c == '\n' || c == '\r'){
                        /*if(j == 1){
                            j = 0;
                            continue;
                        }else{*/
                            while(j<(height+1)){
                                ary[i][j] = blankChar;
                                j++;
                            }
                            j = height;
                        //}
                    }else{
                        ary[i][j] = c;
                    }
                }
            }
        }
        for(j=0; j<=(height + 1); j++){
            for(i=0; i<=width*2; i++){
                t += ary[i][j];
            }
            t += "\r\n";
        }
        t += "\r\n";

    }
    if(!document.getElementById("addlink").checked){
        t += "\r\n此古书式竖排格式由http://www.cshbl.com/gushu.html在线转换工具生成\r\n";
    }
    document.getElementById("t").value = t;
    setCookie("templet", tblTemplet + '');
    setCookie("x", width + '');
    setCookie("y", height + '');
    
}

var half = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','(',')','[',']','{','}','<','>','*','&','^','%','$','#','@','!','~','`','+','-','=','_','|','\\','\'','"',';',':','.',',','?','/',' ','（','）','【','】','《','》', '…', '—', '～', '“', '”', '‘', '’'];
var full = ['０','１','２','３','４','５','６','７','８','９','ａ','ｂ','ｃ','ｄ','ｅ','ｆ','ｇ','ｈ','ｉ','ｊ','ｋ','ｌ','ｍ','ｎ','ｏ','ｐ','ｑ','ｒ','ｓ','ｔ','ｕ','ｖ','ｗ','ｘ','ｙ','ｚ','Ａ','Ｂ','Ｃ','Ｄ','Ｅ','Ｆ','Ｇ','Ｈ','Ｉ','Ｊ','Ｋ','Ｌ','Ｍ','Ｎ','Ｏ','Ｐ','Ｑ','Ｒ','Ｓ','Ｔ','Ｕ','Ｖ','Ｗ','Ｘ','Ｙ','Ｚ','︵','︶','︻','︼','︷','︸','︽','︾','＊','＆','︿','%','＄','＃','＠','！','～','｀','+','－','＝','＿','｜','＼','＇','＂','；','：','。','，','？','／', blankChar,'︵','︶','︻','︼','︽','︾', '┇', '│', '','﹁','﹂','﹃','﹄'];


function getChar(s, index){
    if(index >= s.length){
        return blankChar;
    }
    var c = s.charAt(index);
    for(var i=0; i<half.length; i++){
        if(c == half[i]){
            c = full[i];
        }
    }
    return c;
}

function copyresult(){
    var s = document.getElementById("t").value.toString();
    if (s.length == 0){
        alert("现在没有转换格式后的文字，请首先转换文字。");
        return;
    }
    var e=document.getElementById("t");
    e.focus();
    e.select();
    if(document.all){
        var r = e.createTextRange();
        r.execCommand("Copy");
    }else{
        alert("您的浏览器不支持javascript剪贴板操作，请用Ctrl + C拷贝结果文字");
        return;
    }
}

function setCookie(name, value, expires, path, domain, secure) {
    var ck = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
    document.cookie = ck;
}

function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function init(){
    document.getElementById('s').focus();
    var v;
    v = getCookie("templet");
    if( v != null){
        document.getElementById("tbl").value = v;
    }
    v = getCookie("x");
    if( v != null){
        document.getElementById("x").value = v;
    }
    v = getCookie("y");
    if( v != null){
        document.getElementById("y").value = v;
    }
}
</script>


</head><body onload="init();">
<div id="content">
<h1>基于JavaScript技术的横排文字转古书式竖排工具</h1>
<p class="desc">此工具可以把普通横排文字转换为古典的竖排由右至左的方式显示，并且增加适当的线标，方便读者阅读。您可以在论坛、博客
发言之前用这个工具把要发表的文章转化，然后再粘贴到要发表的论坛、博客上去。这样还可以有效的防止网站程序对某些词语的检索过滤，且不妨碍阅读。即弘扬
中华古典文化，又增加趣味性。还不快试试。 <span style="color: blue;">按 Ctrl+D 收藏本页</span></p>
<ol>
	<li>
		<div id="source">
			<p class="comment">
			把您要转换的文字输入到下面的输入框中</p>
			<textarea rows="10" cols="100" id="s"></textarea>
		</div>
	</li>
	<li>
		<div id="actions">
		<p class="comment">点击『转换』按钮</p>
		
		每页<select id="x"><option value="5">5</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18" selected="selected">18</option><option value="19">19</option><option value="20">20</option><option value="25">25</option><option value="30">30</option></select>竖行，
		每竖行<select id="y"><option value="5">5</option><option value="8">8</option><option value="9">9</option><option value="10" selected="selected">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="25">25</option><option value="30">30</option></select>个字
		使用<select id="tbl"><option value="0">粗实线+细实线</option><option value="1" selected="selected">双实线+细实线</option><option value="2">细实线+细虚线</option><option value="3">无线框</option><option value="4">无头尾线框</option></select>边框
		<input class="convertbutton" onclick="javascript:convert();" value="转换↓" type="button">
		<input id="addlink" value="add" checked="" type="checkbox"><label for="addlink">不要增加转换器信息</label>
		</div>
	</li>
	<li>
		<div id="target">
			<p class="comment">结果就在下面，你可以拷贝到论坛、博客里面去了</p>
			
			<textarea rows="20" cols="100" id="t" readonly="readonly" onmouseover="this.select();"></textarea>
		</div>
	</li>
</ol>
</div>
</div>
<div id="copyright">
本工具由<a target="_blank" href="http://www.cshbl.com/">CSHBL.com</a>原创。CSHBL享有全部所有权。<br>原作：<a href="http://www.cshbl.com/gushu.html" target="_blank">http://www.cshbl.com/gushu.html</a>
</div>

</body></html>]]></dirTTB><WorldMapTimeZone author="24timezones" date="" common="世界时间"><![CDATA[<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>世界时间 - world map time zone</title>
<script src="http://24timezones.com/map3/swfobject.js" language="javascript"></script>
</head>
<body>
<div id="mapPlaceholder"></div>
<script language="javascript">
window.onload = function(){
    var so = new SWFObject("http://24timezones.com/map3/loader24.swf", "loader2", "980", "534", "8", "#ffffff");
    so.addParam("base", "http://24timezones.com/map3/")
    so.addParam("wmode", "transparent")
    so.addVariable("settingsXML", "http://24timezones.com/map3/data/settings_zh.xml")
    so.addVariable("localizationXML", "http://24timezones.com/map3/data/localization_zh.xml")
    so.addVariable("citiesLocalizationXML", "http://24timezones.com/map3/data/cities_localization_zh.xml")
    so.write("mapPlaceholder");
};
</script>
</body>
</html>]]></WorldMapTimeZone><AutoSizeBox author="dh20156" date="" common="自适应大小类"><![CDATA[<!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd">
<style type="text/css">
#xbox{padding:5px;border:1px solid #716F64;background:#ACA899;}
#xbox .hd{margin:0;background:#0055EA;color:#fff;font-size:20px;}
#xbox .bd{background:#fff;}
#xbox .ft{background:#ECE9D8;}
</style>

<div id="xbox" class="autosize" width="80%" height="60%" rows="30,*,30">
	<h1 class="hd">自适应父节点大小类 - ARBox</h1>
	<div class="bd">
		<dl>
			<dt><strong>使用此方法的DOM元素：</strong></dt>
			<dd>将自动适应其父节点的宽和高;</dd>
			<dd>如果指定了width=[整数|百分数]和height的值，将按给定的值调整;</dd>
			<dd>该元素将被自动设置成为overflow:hidden;</dd>
			<dd>支持rows="25,*25"和cols="20%,*"属性</dd>
			<dd>如果设置了rows或cols，其childNodes将按相应的值自动调整</dd>
			<dd>尺寸调整过的子节点，同时也会被自动设置成为overflow:hidden;</dd>
		</dl>
		<dl>
			<dt><strong>嵌套的设置：</strong></dt>
			<dd>嵌套与本类无关，需要另行编写相关队列实现</dd>
			<dd>可使用自定义属性（如level）进行抓取，按level优先级存入队列</dd>
			<dd>window resize的时候可以按队列顺序进行调整</dd>
		</dl>
		<dl>
			<dt><strong>注意：</strong></dt>
			<dd>请声明DTD</dd>
			<dd>最好在使用了reset样式后使用</dd>
			<dd>请酌情使用或参考</dd>
		</dl>
	</div>
	<div class="ft"><a href="http://www.w3cgroup.com">W3CGroup</a> <a href="http://www.v-ec.com/dh20156/">dh20156</a></div>
</div>
<script type="text/javascript" src="http://www.easyui.org.cn/easyui.js"></script>
<script type="text/javascript">
window.onload = function(){
var ARBox = function(dbox){
	if(!dbox||dbox.nodeType==3){return;}
	this.rows = dbox.getAttribute('rows');
	this.cols = dbox.getAttribute('cols');
	var am = this.getmpb(dbox,'margin'),ap = this.getmpb(dbox,'padding'),ab = this.getmpb(dbox,'border');
	this.mpb = [(am[0]+am[2]+ap[0]+ap[2]+ab[0]+ab[2]),(am[1]+am[3]+ap[1]+ap[3]+ab[1]+ab[3])];
	dbox.style.overflow = 'hidden';
	this.dbox = dbox;
	this.onresize = null;
};
ARBox.prototype = {
	getmpb:easyUI.getmpb,
	s2d:function(s,io){/*将类似 10%,* 字样转换成具体的数值*/
		var as = s.split(','),l = as.length,tmp,sidx = null,count = 0;
		for(var i=0;i<l;i++){
			tmp = as[i];
			if(tmp=='*'){sidx = i;continue;}
			as[i] = isNaN(tmp)?(/^(\d+)\%$/.test(tmp))?parseInt(parseInt(RegExp.$1)/100*io):io:tmp;
			count += parseInt(as[i]);
		}
		if(sidx){as[sidx] = parseInt(io-count);}
		return as.slice(0);
	},
	resize:function(){
		var db = null,dp,tmpdp1,tmpdp2,pw,ph,iw,iw2,ih,ih2,ampb,sr,ar,sc,ac,dc,lc,dcn,s2d,am,ap,db;
		var foors = this.onresize;
		db = this.dbox,dp = db.parentNode,tmpdp = dp,s2d = this.s2d;
		/*取dbox父节点宽高*/
		if(dp.tagName.toLowerCase()=='body'){
			var ws = easyUI.getWindowSize();pw = ws.width,ph = ws.height;
		}else{
			while(tmpdp){if((pw=parseInt(tmpdp.clientWidth))){break;}tmpdp=tmpdp.parentNode}
			ph=parseInt(tmpdp.clientHeight);dp = tmpdp;
		}
		/*取父节点Marrgin,Padding,Border值*/
		am = this.getmpb(dp,'margin'),ap = this.getmpb(dp,'padding'),ab = this.getmpb(dp,'border');
		ampb = [(am[0]+am[2]+ap[0]+ap[2]+ab[0]+ab[2]),(am[1]+am[3]+ap[1]+ap[3]+ab[1]+ab[3])];
		/*从父节点宽高尺寸中减去MPB值*/
		pw -= ampb[0],ph -= ampb[1];
		/*取dbox相关属性*/
		iw = db.getAttribute('width'),ih = db.getAttribute('height');
		sr = this.rows,sc = this.cols,dc = db.childNodes,ampb = this.mpb;
		iw = isNaN(iw)?(/^(\d+)\%$/.test(iw))?parseInt(parseInt(RegExp.$1)/100*pw):pw:iw;
		ih = isNaN(ih)?(/^(\d+)\%$/.test(ih))?parseInt(parseInt(RegExp.$1)/100*ph):ph:ih;
		/*设置dbox宽高*/
		if(iw&&iw>0){db.style.width = iw-ampb[0]+'px';}if(ih&&ih>0){db.style.height = ih-ampb[1]+'px';}
		/*准备更新dbox childNodes尺寸*/
		iw = iw||parseInt(db.clientWidth),ih = ih||parseInt(db.clientHeight);
		iw -= ampb[0],ih -= ampb[1],ar = sr?s2d(sr,ih):null,ac = sc?s2d(sc,iw):null,lc = dc.length;
		for(var n=0,ni=0;n<lc;n++){/*更新childNodes尺寸*/
			dcn = dc[n];if(dcn.nodeType==3){continue;}
			am = this.getmpb(dcn,'margin'),ap = this.getmpb(dcn,'padding'),ab = this.getmpb(dcn,'border');
			ampb = [(am[0]+am[2]+ap[0]+ap[2]+ab[0]+ab[2]),(am[1]+am[3]+ap[1]+ap[3]+ab[1]+ab[3])];
			ih2 = (sr?ar[ni]:ih),iw2 = (sc?ac[ni]:iw);
			if(sr){dcn.style.height = ih2-ampb[1]+'px';}
			if(sc){dcn.style.width = iw2-ampb[0]+'px';}
			dcn.style.overflow = 'hidden';
			ni++;
		}
		if(typeof foors=='function'){foors();}
	}
};
var dx = document.getElementById('xbox');
var odx = new ARBox(dx);
odx.resize();
try{window.attachEvent('onresize',function(){odx.resize();});}catch(e){window.addEventListener('resize',function(){odx.resize();},false);}
};
</script>]]></AutoSizeBox><Lateness author="EMU" date="" common="firefox下setTimeout的诡异函数"><![CDATA[<script type="text/javascript">
var delay=3000;
if(/firefox/i.test(navigator.userAgent)){
    window.setTimeout(test,delay,'arg1','arg2');
    alert("试试等一会再确认")
}else{
    alert("只有 firefox 浏览器支持 Lateness 参数！")
}
function test(){
    var t=arguments[arguments.length-1]
    alert(Array.prototype.slice.call(arguments,0));
    alert("你点alert之前犹豫了"+(t<2?"不到"+delay:delay+t)+"毫秒");
}
</script>]]></Lateness><GoogleAjaxLanguageAPI author="google" date="" common="google翻译API接口"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google AJAX Language API - Basic Translation</title>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">

    google.load("language", "1");

    function initialize() {
      google.language.translate("Happy new year!", "en", "zh-CN", function(result) {
        if (!result.error) {
          var container = document.getElementById("translation");
          container.innerHTML = result.translation;
        }
      });
    }
    google.setOnLoadCallback(initialize);

    </script>
  </head>
  <body>
    <div id="translation"></div>
  </body>
</html>]]></GoogleAjaxLanguageAPI><hasLayoutBug author="dh20156" date="" common=""><![CDATA[<style type="text/css">
.ui-dialog-body {
	border: 1px solid #CCC;
	border-top: none;
	padding: 16px 20px;
	background: #FFF;
	/*zoom:1;*/
}
</style>

<div class="ui-dialog-body">
<fieldset>
<p><a href="javascript:div_recurrence_outer.style.display=(div_recurrence_outer.style.display!='block')?'block':'none';void(0);">Click here test</a></p>

<p style="display: none;" id="div_recurrence_outer">ok,you got me!</p>
</fieldset>

<fieldset style="position: relative;">hello,world!</fieldset>  
</div>]]></hasLayoutBug><ZIndexInIE author="dh20156" date="" common="ZIndex在IE中的特殊表现"><![CDATA[<style type="text/css">
ul{width:100%;}
li{width:100%;height:50px;position:relative;}
.tips{background:yellow;width:200px;height:100px;position:absolute;right:100px;top:0;}
</style>
<fieldset>
<legend>IE中子元素的ZINDEX无法穿越父元素的ZINDEX</legend>
<ul>
<li>
<p>test</p>
<div class="tips" style="z-index:2;">遭受凌辱中 - -!</div>
</li>
<li>
<p>test 2</p>
<span style="position:absolute;right:50px;top:0;">我上你下哦 ^_^</span>
</li>
</ul>
</fieldset>

<fieldset>
<legend>修正</legend>
<ul>
<li style="z-index:2;">
<p>test</p>
<div class="tips">扬眉吐气哇 ^_^</div>
</li>
<li style="z-index:1;">
<p>test 2</p>
<span style="position:absolute;right:50px;top:0;">被压在下面鸟 - -!</span>
</li>
</ul>
</fieldset>]]></ZIndexInIE><asfasdf author="" date="" common=""><![CDATA[asdfasdf]]></asfasdf><sd author="sd" date="sd" common="sd"><![CDATA[<script>
alert('sss');
</script>]]></sd><sfasdf author="sadf" date="20200101" common="sadf"><![CDATA[<script>
alert('sss');
</script>]]></sfasdf><fds author="" date="" common=""><![CDATA[dsf]]></fds><ThermalMotion author="JK" date="" common=""><![CDATA[<HTML><HEAD><TITLE>热运动</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<style>
body{background-color:#fff}
.ball{position:absolute;font-size:10px;}
.ball0{color:blue}
.ball1{color:blue}
.ctn-tbl {width:400px;height:500px;position:absolute;left:100px;top:100px;}
.ctn-tbl td {border:solid #ccc 1px;border-bottom:solid red 2px;}
#report-text1 {font-size:12px;width:90px;height:500px;position:absolute;left:600px;top:100px}
#report-text2 {font-size:12px;width:90px;height:500px;position:absolute;left:700px;top:100px}
#report-text3 {font-size:12px;width:90px;height:500px;position:absolute;left:800px;top:100px}
</style>
</HEAD>
<BODY>
说明：两个箱子大小相同，分子量左箱是右箱的四倍，个数左右是右箱的四分之一，有重力时箱子变成无限高（平衡后底部压强也会是一样的）<br/>
添加重力加速度：<input type=checkbox onclick="MoleculeShow.g=this.checked?0.05:0;"/> &nbsp;&nbsp;
开启热传递：<input type=checkbox onclick="MoleculeShow.slideOk=this.checked?true:false;"/> &nbsp;&nbsp;<br/>
清空报告：<input type=button value='清空报告' onclick="MoleculeShow.clearReport();"/>&nbsp;&nbsp; 
暂停/开启：<input type=button value='暂停/继续' onclick="MoleculeShow.switchRun();"/><br/>
分析：1。高度越高，温度越低；2。如果导热底部的压强与温度相同，则高度对分子量大的气体温度的影响大，所以在同一高度，右箱的温度高于左箱。
<table cellpadding=0 cellspacing=0 border=0 class="ctn-tbl" id="ctn-tbl">
	<tr>
		<td >&nbsp;</td>
		<td >&nbsp;</td>
	</tr>
</tr>
</table>
<textarea name=report-text id=report-text1>左箱分子均能
</textarea>
<textarea name=report-text id=report-text2>右箱分子均能
</textarea>
<textarea name=report-text id=report-text3>导热片分子均能
</textarea>
<SCRIPT language=javascript>

var MoleculeShow =(function(){
	var $=function(id){
		return document.getElementById(id);
	};
	var createElement=function(tagName,opts){
		var el=document.createElement(tagName),opts=opts||{};
		for(var i in opts) el[i]=opts[i];
		return el;
	};

	var MoleculeShow ={
		g:0,//重力加速度
		r:5,
		ballsNum:20,//各容器的分子数
		ballsA:{mass:4,	//质量
				num:40,
				rect:{left:100,top:100,height:500,width:200}
			},
		ballsB:{mass:1,
				num:40,
				rect:{left:300,top:100,height:500,width:200}
			},
		slidePower: 0,
		slideNum:9,
		slideOk:false,
		timer:0
	};
	MoleculeShow.init=function(){
		var balls=[MoleculeShow.ballsA,MoleculeShow.ballsB];
		for(var i=0;i<2;i++){
			balls[i].els=[];
			var len=balls[i].num;
			for(var j=0;j<len;j++){
				var el=createElement('div',{className:'ball ball'+i,innerHTML:i?'〇':'●'});
				document.body.appendChild(el);
				var pos={
					x:balls[i].rect.left+10+Math.random()*180,//x坐标
					y:balls[i].rect.top+10+Math.random()*400,//y坐标
					vx:4*Math.random()-2,//x速度
					vy:4*Math.random()-2,//y速度
					penged:0
				}
				el.__pos=pos;
				balls[i].els.push(el);
			}
		}
		//MoleculeShow.ballsA
	};
	MoleculeShow.run=function(){
		var balls=[MoleculeShow.ballsA,MoleculeShow.ballsB];
		for(var i=0;i<2;i++){
			var len=balls[i].num;
			var rect=balls[i].rect;
			var els=balls[i].els;



			for(j=0;MoleculeShow.slideOk && j<len;j++)//热传递
			{
				var posJ=els[j].__pos;
				if(posJ.penged<5) continue;//如果没发生碰撞的话，就不进行热传递了
				if (posJ.y>rect.top+rect.height-MoleculeShow.r)
				{
						var power=balls[i].mass*(posJ.vx*posJ.vx+posJ.vy*posJ.vy)/2;
						MoleculeShow.slidePower=(power+MoleculeShow.slidePower)*MoleculeShow.slideNum/(MoleculeShow.slideNum+1);//相当于导热片有九个分子
						posJ.vx=Math.sqrt(MoleculeShow.slidePower/MoleculeShow.slideNum/power)*posJ.vx;
						posJ.vy=Math.sqrt(MoleculeShow.slidePower/MoleculeShow.slideNum/power)*posJ.vy;
						posJ.penged=0;
				}
			}

			for(j=0;j<len;j++)//互相碰撞
			{
				var posJ=els[j].__pos;
				for (k=0;k<j;k++)
				{
					var posK=els[k].__pos;
					if(((posK.x-posJ.x)*(posK.x-posJ.x)+(posK.y-posJ.y)*(posK.y-posJ.y))<4*MoleculeShow.r*MoleculeShow.r)//距离小于直径
					{
						if(true){//判断是否是在靠近
							var p1=[posK.x-posJ.x,posK.y-posJ.y],
								p2=[posK.vx-posJ.vx,posK.vy-posJ.vy],
								p3=[p1[0]-p2[0],p1[1]-p2[1]];
							if(p1[0]*p1[0]+p1[1]*p1[1] + p2[0]*p2[0]+p2[1]*p2[1] >= p3[0]*p3[0]+p3[1]*p3[1])//两个向量夹角为钝角
							{
								continue;
							}
						}				
						//弹性磁撞
						posJ.penged++;
						posK.penged++;
						var jkrad=Math.sqrt((posK.x-posJ.x)*(posK.x-posJ.x)+(posK.y-posJ.y)*(posK.y-posJ.y))
						var jksin=(posJ.y-posK.y)/jkrad;
						var jkcos=(posJ.x-posK.x)/jkrad;

						var cx=[0,0],cy=[0,0];
						cx[0]=posJ.vx*jkcos+posJ.vy*jksin;
						cy[0]=-posJ.vx*jksin+posJ.vy*jkcos;
						cx[1]=posK.vx*jkcos+posK.vy*jksin;
						cy[1]=-posK.vx*jksin+posK.vy*jkcos;
						posJ.vx=cx[1]*jkcos-cy[0]*jksin;
						posJ.vy=cx[1]*jksin+cy[0]*jkcos;
						posK.vx=cx[0]*jkcos-cy[1]*jksin;
						posK.vy=cx[0]*jksin+cy[1]*jkcos;
					}
				}
			}

			for(j=0;j<len;j++)//边框碰撞
			{
				var posJ=els[j].__pos;
				if (posJ.x>=rect.left+rect.width-MoleculeShow.r) posJ.vx=-Math.abs(posJ.vx);
				if (posJ.x<=rect.left+MoleculeShow.r) posJ.vx=Math.abs(posJ.vx);
				if (els[j].__peng = 
					(posJ.y>=rect.top+rect.height-MoleculeShow.r && posJ.vy>0) 
					|| (posJ.y<=rect.top+MoleculeShow.r && posJ.vy<0) && !MoleculeShow.g //没有重力时，则不需要顶板，以达到理论稀薄气体的效果
				) posJ.vy=-posJ.vy;
			}

			for(j=0;j<len;j++)//重设位置
			{
				var posJ=els[j].__pos;
				posJ.x=posJ.x+posJ.vx;
				if(!els[j].peng){
					posJ.y=posJ.y+posJ.vy+MoleculeShow.g/2;
					posJ.vy +=MoleculeShow.g;//重力加速度
				}
				els[j].style.left=(posJ.x-MoleculeShow.r)+'px';
				els[j].style.top=(posJ.y-MoleculeShow.r)+'px';
			}
		}
		MoleculeShow.timer=setTimeout(function(){MoleculeShow.run()},10);

	};

	MoleculeShow.switchRun = function(){
		if(MoleculeShow.timer) {
			clearTimeout(MoleculeShow.timer);
			MoleculeShow.timer=0;
		}
		else MoleculeShow.run();
	};
	MoleculeShow.report=function(){
		var textareas=document.getElementsByName('report-text');
		var balls=[MoleculeShow.ballsA,MoleculeShow.ballsB];
		for(var i=0;i<balls.length;i++){
			var power=0;
			for(var j=0;j<balls[i].els.length;j++){
				var posJ=balls[i].els[j].__pos;
				power+=((posJ.vx*posJ.vx+posJ.vy*posJ.vy)/2+(balls[i].rect.height+balls[i].rect.top-posJ.y-MoleculeShow.r)*MoleculeShow.g)*balls[i].mass;
			}
			textareas[i].value+=(power/balls[i].els.length).toFixed(2)+'\n';
		}
		textareas[2].value+=(MoleculeShow.slidePower/MoleculeShow.slideNum).toFixed(2)+'\n';
		setTimeout(function(){MoleculeShow.report()},10000);
	};
	MoleculeShow.clearReport=function(){
		var textareas=document.getElementsByName('report-text');
		for(var i =0;i<textareas.length;i++){
			textareas[i].value=textareas[i].defaultValue;
		}
	};
	return MoleculeShow;
})();

MoleculeShow.init();
MoleculeShow.run();
MoleculeShow.report();

</SCRIPT>
</BODY></HTML>]]></ThermalMotion><hhhhhhh author="hhhhh" date="hhhhhhhhhhhh" common="hhhhhhhh"><![CDATA[hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh]]></hhhhhhh></code>
