熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

復制js對象方法

2022-06-13   來源: JSP教程 
復制js對象方法需要的朋友可以參考下   復制代碼 代碼如下:

  
CSSCommonJSDeepCopy = function (json) {
    if (typeof json == number || typeof json == string || typeof json == boolean) {
        return json;
    } else if (typeof json == object) {
        if (json instanceof Array) {
            var newArr = [] i len = jsonlength;
            for (i = ; i < len; i++) {
                newArr[i] = argumentscallee(json[i]);
            }
            return newArr;
        } else {
            var newObj = {};
            for (var name in json) {
                newObj[name] = argumentscallee(json[name]);
            }
            return newObj;
        }
    }
}


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20472.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.