我没学过javascript,求注解啊!!越详细越好,谢啦!function changeDrop1() {
   if(form1.rootTypeName.options[form1.rootTypeName.selectedIndex].value!="")
   {
    
init();
 
var url = "getMarketType?rootName=" + escape(form1.rootTypeName.options[form1.rootTypeName.selectedIndex].value);
 
req.open("GET", url, true);
req.onreadystatechange = callback;
req.send(null);
}
else
{
    list.productArea.length = 1;
                 list.productArea.options[0].value = '';
                  list.productArea.options[0].text = 'Pls Select!';
                  list.productArea.selectedIndex = 0;
}

}

解决方案 »

  1.   

    你给的js很不全哦,req应该是request吧?从代码上看应该是一个根据下拉框的选择情况判断是不是发送请求的
      

  2.   

    前面还有个init函数:
    var req;

    function init() {
    if(window.XMLHttpRequest) {
    req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    }
    }
      

  3.   


    //通过选择下拉列表选项来刷新list列表数据函数
    function changeDrop1() {
    //如果form1的选择框rootTypeName的选项options的selectedIndex的值为空
    if(form1.rootTypeName.options[form1.rootTypeName.selectedIndex].value!="")
    {
    //通过ajax初始化form1的选择框rootTypeName的选项options
    init();
      
    var url = "getMarketType?rootName=" + escape(form1.rootTypeName.options[form1.rootTypeName.selectedIndex].value);
      
    req.open("GET", url, true);
    req.onreadystatechange = callback;
    req.send(null);
    }
    //否则list增加一项,内容为'Pls Select!'
    else
    {
    list.productArea.length = 1;
      list.productArea.options[0].value = '';
      list.productArea.options[0].text = 'Pls Select!';
      list.productArea.selectedIndex = 0;
    }}
      

  4.   

    http://www.w3school.com.cn/这个网站很不错啊,力荐!
      

  5.   

    如果用户对下拉框进行了选择,则创建一个XMLHttpRequest对象,对于IE5和IE6创建的是ActiveX对象(这是为了跨浏览器执行),然后使用该对象去和后台交互~~就这些了~