IDE啊

今天浪费了半天时间debug.原因就是断点设得不对。对错误的范围做了错误的假设,甚至开始怀疑一些很基本的知识。结果最后发现是自己写的一段代码改了变量的值。当然这也是自己基础不坚实。还有就是经验不足没想到自己在page里写的代码改了ascx里的值。但如果Visual  Studio能够有很好的Code  Analysis的能力的话,也不会漏掉。就类似Reflector的Code  Analyze(Depends on和UsedBy)的功能。VS2005怎么就没有呢?(虽然菜单里也有Find  references的功能,但那个从来就太弱了)希望2008能有更大的进步。

用JS调用xmlhttp对象的基本格式

虽然现在AJAX控件和类库层出不穷。但这个基础知识还是值得整理收藏一下。

try{
        xmlhttp= new ActiveXObject(‘Msxml2.XMLHTTP’);
    }catch(e){
        try{
            xmlhttp= new ActiveXObject(‘Microsoft.XMLHTTP’);
        }catch(e){
            try{
                xmlhttp= new XMLHttpRequest();
            }catch(e){}
        }
    }
    xmlhttp.onreadystatechange=function(){
        if(xmlhttp.readyState==4){
            if(xmlhttp.status==200){                
                      // do something           
            }else{
                alert(“Server Busy,Please try again later!”);              
            }
        }
    }
xmlhttp.open(“post”,url); //url is a variable
xmlhttp.setRequestHeader(‘Content-type’,’application/x-www-form-urlencoded’);
xmlhttp.send(“v1=”+escape(v1)+”&v2=”+escape(v2)+”&v3=” + escape(v3) );//v1,v2,v3 are variables