随笔 - 4  文章 - 0  评论 - 52 
  2009年5月16日
摘要: win7 上安装 vs2008和打VS2008 SP1补丁时由于IIS7的设置问题,兼容性问题,耗了很多时间,看到网上有较多问相关问题的,发出来分享一下我的痛苦的成功经历阅读全文
posted @ 2009-05-16 02:05 圣盗 阅读(15239) 评论(43) 编辑
  2008年12月16日
摘要: 一个较笨的解决用户控件循环引用问题的方法阅读全文
posted @ 2008-12-16 01:27 圣盗 阅读(340) 评论(0) 编辑

之前用 MagicAjax 做了一个项目,已经上线了两三个月,最近客户说它经常会把 IE 弄死,找了好几天,没有发现程序有什么问题,但是浏览器偶尔是会死掉(占 CPU 50%-双核),程序都找完了就去找 MagicAjax 的代码,意外发现了 MagicAjax 的 JS 中有一个内存泄漏的 BUG (不过和我的问题无关,因为我改了后, IE 还是会死),现在说一下这个 BUG 供使用 MagicAjax 的朋友参考一下.
在 AjaxCallObject 类的方法 DoAjaxCall 有这样一段代码:

Code

其中 __AJAXCboList 是一个数组,在每次提交 ( POST ) 数据前会把当前对象放入数组中,并新建一个对象供下一个提交( POST )使用.当在使用异步提交时,处理服务器返回数据的方法如下 :

Code

可见当提交( POST )完成后,会给之前放入的 AJAXCbo 对象赋空值并从数组 __AJAXCboList 中删除,以便浏览器回收对象,这里没有什么问题,有问题的是当使用同步提交( POST )时, MagicAjsx 并没有使用 ReadyStateChange 方法来处理回发的数据,而是用直接写的方法来处理的:

 1 // Synchronous
 2 // 使用定时器,以便显示那个黑黑的Loading层,可见MagicAjax中的同步不是真正的同步
 3 window.setTimeout(
 4     function()
 5     {
 6         oThis.XmlHttp.open("POST", thePage, false);
 7         oThis.XmlHttp.setRequestHeader('Content-Type''application/x-www-form-urlencoded');
 8         oThis.XmlHttp.send(theData);
 9 
10         if( oThis.XmlHttp.status == 200 && oThis.XmlHttp.statusText == "OK" )
11             oThis.OnComplete(oThis.XmlHttp.responseText, oThis.XmlHttp.responseXML);
12         else
13             oThis.OnError(oThis.XmlHttp.status, oThis.XmlHttp.statusText, oThis.XmlHttp.responseText);
14     }, 1);

当提交( POST )完成后,__AJAXCboList数组中将始终保留这个 AJAXCbo 对象.我测试过,没有其它的地方会释放里面的数据,除非刷新页面.我后来把它改成也用 ReadyStateChange 方法来处理就没有这个问题了.

 1 window.setTimeout(
 2 function()
 3 {
 4     oThis.XmlHttp.open("POST", thePage, false);
 5     oThis.XmlHttp.onreadystatechange = function(){ oThis.ReadyStateChange(); };
 6     oThis.XmlHttp.setRequestHeader('Content-Type''application/x-www-form-urlencoded');
 7     oThis.XmlHttp.send(theData);
 8 
 9     //if( oThis.XmlHttp.status == 200 && oThis.XmlHttp.statusText == "OK" )
10     //    oThis.OnComplete(oThis.XmlHttp.responseText, oThis.XmlHttp.responseXML);
11     //else
12     //    oThis.OnError(oThis.XmlHttp.status, oThis.XmlHttp.statusText, oThis.XmlHttp.responseText);
13 }, 1);


posted @ 2008-12-16 00:51 圣盗 阅读(2093) 评论(9) 编辑
  2008年8月18日
摘要: //改变父控件中所有子控件的ENABLED //parentID 为父控件或父控件ID //disabled为是否禁用true 为禁用,false 为可用 //filter为不更改disabled而更改readOnly的以|分隔的控件ID列表 阅读全文
posted @ 2008-08-18 13:47 圣盗 阅读(138) 评论(0) 编辑