function Sing() 
    { 
        with(arguments.callee) 
          alert(author + ":" + poem); 
    }; 
    Sing.author = "李白"; 
    Sing.poem = "汉家秦地月,流影照明妃。一上玉关道,天涯去不归"; 
    Sing(); 
    Sing.author = "李战"; 
    Sing.poem = "日出汉家天,月落阴山前。女儿琵琶怨,已唱三千年"; 
    Sing(); 

假设我们页面有: 
<style type="text/css"> 
.red{background:red;color:#ffffff} 
.blue{background:blue;color:yellow} 
</style> 
<input id="test" type="text" name="test" value=""/> 
<input type="button" value="Changed" οnclick="test()"/> 
<input type="button" value="withChanged" οnclick="testWith()"/> 
我们想通过按钮来改变文本框的一些属性,按照常规的写法是: 
 function test(){ 
    var obj = document.getElementById("test"); 
      obj.value = "test no with"; 
      obj.className="red"; 
  } 
而用with的话,我们可以这么写: 
  function testWith(){ 
      var obj = document.getElementById("test"); 
      with(obj){ 
        value = "test use with"; 
        className="blue"; 
      } 
   } 

arguments 函数的参数
callee 当前正在执行的函数

function factorial(n){
if (n <= 0)
return 1;
else
return n * arguments.callee(n - 1)
}

这个例子就相当于 递归的写法

 

文章出处:http://tieba.baidu.com/f?kz=617643246 Copy过来的

 

javascript的with表示什么

 
  
当你有一个对象的多个属性或者方法需要操作时,就可以使用with

比如
<body>
test
<script type="text/javascript">
var o=document.createElement("div");
with(o){
    style.cursor="pointer";
    style.zIndex="100";
    innerHTML="aaaa";
}
document.body.appendChild(o);
</script>
</body>
上面的代码相当于

<body>
test
<script type="text/javascript">
var o=document.createElement("div");
    o.style.cursor="pointer";
    o.style.zIndex="100";
    o.innerHTML="aaaa";
document.body.appendChild(o);
</script>
</body>

所以with 用于简化 代码 操作。
文章出处: http://zhidao.baidu.com/question/75260303.html