易截截图软件、单文件、免安装、纯绿色、仅160KB

JavaScript 深度克隆 JSON 对象


function
 clone(jsonObj) {  
    var
 buf;  
    if
 (jsonObj 
instanceof
 Array) {  
        buf = [];  
        var
 i = jsonObj.length;  
        while
 (i--) {  
            buf[i] = clone(jsonObj[i]);  
        }  
        return
 buf;  
    }else
 
if
 (jsonObj 
instanceof
 Object){  
        buf = {};  
        for
 (
var
 k 
in
 jsonObj) {  
            buf[k] = clone(jsonObj[k]);  
        }  
        return
 buf;  
    }else
{  
        return
 jsonObj;  
    }  



相关文档:

Javascript和Ajax中文乱码吐血版解决方案

引自:http://www.cnblogs.com/dongritengfei/archive/2009/12/21/1628489.html
 
今天弄了一天的Ajax中文乱码问题,Ajax的乱码问题分为两种:
1. JavaScript输出的中文乱码,
比如:alert("中文乱码测试");
解决的办法比较简单,就是把jsp里所有的charset和pageEncoding的值都设置成相同的,一般是utf-8.
  ......

JavaScript 设为主页与加入收藏

//设置当前页面为用户的首页
function setHomepage()
{
   document.body.style.behavior='url(#default#homepage)';
   document.body.setHomePage(window.location.href);
   event.returnValue=false;
   return;
}
//加入收藏
function addFavorite()
{
 &nb ......

用javascript控制框架的src属性

<input   type=button   onclick="aaa();"   value="确定">  
  <iframe   name="frame1">  
  <script   language=javascript>  
  function   aaa()  
  {  
  docume ......

javascript 中的innerHTML的用法

javascript中innerHtml用法
2009-04-21 22:52
<html>
<head>
<script language="javascript">
function Test(){
       var str="";
       str+="Hello,";
       str+="This ......

史上最牛X最简洁的Javascript图片缩放代码

源码:
function resize(img, width, height) {
 (img.width > img.height)
 ? ((img.height = Math.min(height, width * img.height/img.width)) || (img.width = Math.min(width, img.width)))
 : ((img.width = Math.min(width, height * img.width/img.height)) || (img.height = Math.min(hei ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号