with (top.window.location){
   href = "abc.html";
}如果不用with方法,则需要这样:
top.window.location.href = "abc.html";with方法的作用: 缩写其参数部分(起到偷懒的作用,个人认为^_^)

解决方案 »

  1.   

    补充一下with可以嵌套用。相当于vbs里的with
      

  2.   

    with (top.window.location)
    {baseURL = href.substring (0,href.lastIndexOf ("/") + 1)}
    total_toc_items = 0;
    current_overID = "";
    last_overID = "";
    browser = navigator.appName;
    version = parseInt(navigator.appVersion);
    client=null;
    loaded = 0;
    if (browser == "Netscape" && version >= 3) client = "ns3";
    function toc_item (img_name,icon_col,width,height) {
    if (client =="ns3") {
    img_prefix = baseURL + img_name;
    this.icon_col = icon_col;
    this.toc_img_off = new Image (width,height);
    this.toc_img_off.src = img_prefix + "_off.gif";
    this.toc_img_on = new Image (width,height);
    this.toc_img_on.src = img_prefix + "_on.gif";
    }
    }
    这一段能不能详细解释一下
      

  3.   

    when use "with",all the attributes below are all belong to the object after "with".
      

  4.   

    比如这句就用了top.window.locationwith (top.window.location)
    {baseURL = href.substring (0,href.lastIndexOf ("/") + 1)}
    等价于
    baseURL = top.window.location.href.substring (0,href.lastIndexOf ("/") + 1)