上次由于一个'\t'让我郁闷了半天,本以为自己已经在debug的时候很小心了,没有想到今天又载了一会
。错误非常之低级,而debug费力又还非常之大,真是让人哭笑不得。所以干脆在blog的随笔里专门开辟一个叫"Debug中的滑铁卢"的分类,专门记录Debug时一些stupid的小事。
其实Coding是挺枯燥的,这个我在说Whidbey的Snippets功能时就说过,而且特别是重复的Coding,更是让人烦躁
。但是不管枯燥也好烦躁也罢,还是要写不。这时我们常常也会学学网站编辑,动用动用Ctrl+C & Ctrl+V大法。这不手艺欠佳,今天我就载在这个Ctrl+C、V上了,看来注定当不成网站编辑了(就这追求啊,浪费了我这么多时间看你这么些天瞎摆活了
!)。
今天这个问题其实超级的简单,真是too simple, too young ...,我在GetShowTab()方法前定义了两个方法,我写成这样的:
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
DimTreeTab.prototype.ShowMemberTree =
function()
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
};
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
DimTreeTab.prototype.ShowSearchMember =
function()
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
};
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
DimTreeTab.prototype.GetShownTab =
function()
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
if (
this.m_Panels[0].m_Element.style.display == 'inline' )
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
//
. . .
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
}
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
};
这时发现这两个函数里面需要用 this.m_Panels[0].m_Element.style.display。好啊,Ctrl+C & Ctrl+V,搞定!
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
DimTreeTab.prototype.ShowMemberTree =
function()
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
this.m_Panels[0].m_Element.style.display == 'inline'
this.m_Panels[0].m_Element.style.display == 'inline'
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
};
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
DimTreeTab.prototype.ShowSearchMember =
function()
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
this.m_Panels[0].m_Element.style.display == 'inline'
this.m_Panels[0].m_Element.style.display == 'inline'
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
};
改拨改拨,ok了~~
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
DimTreeTab.prototype.ShowMemberTree =
function()
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
this.m_Panels[0].m_Element.style.display == 'inline'
this.m_Panels[
1].m_Element.style.display == '
none'
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
};
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
DimTreeTab.prototype.ShowSearchMember =
function()
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
this.m_Panels[0].m_Element.style.display == '
none'
this.m_Panels[
1].m_Element.style.display == 'inline'
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
};
运行起来完全没有效果,由于对DHTML中的element引用关系比较复杂,老是觉得可能是没有引用到正确的element,就在this.m_Panels[n].m_Element里查啊查啊,查到花儿都谢了,还是没有查到问题
。最后都调试成这样了:
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
DimTreeTab.prototype.ShowMemberTree =
function()
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
alert(
this.m_Panels[0].m_Element.outerHTML);
this.m_Panels[0].m_Element.style.display == 'inline';
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
alert(
this.m_Panels[0].m_Element.outerHTML);
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
alert(
this.m_Panels[1].m_Element.outerHTML);
this.m_Panels[1].m_Element.style.display == 'none';
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
alert(
this.m_Panels[1].m_Element.outerHTML);
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
};
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
DimTreeTab.prototype.ShowSearchMember =
function()
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
alert(
this.m_Panels[0].m_Element.outerHTML);
this.m_Panels[0].m_Element.style.display == 'none';
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
alert(
this.m_Panels[0].m_Element.outerHTML);
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
alert(
this.m_Panels[1].m_Element.outerHTML);
this.m_Panels[1].m_Element.style.display == 'inline';
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
alert(
this.m_Panels[1].m_Element.outerHTML);
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
};
才猛然发现,怎么赋值是"=="啊!!!![hitwall.gif](http://www.cnblogs.com/Emoticons/hitwall.gif?x-oss-process=image/resize,w_1400/format,webp)
![hitwall.gif](http://www.cnblogs.com/Emoticons/hitwall.gif?x-oss-process=image/resize,w_1400/format,webp)
。正确的应该是:
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
DimTreeTab.prototype.ShowMemberTree =
function()
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
this.m_Panels[0].m_Element.style.display = 'inline';
this.m_Panels[1].m_Element.style.display = 'none';
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
};
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
DimTreeTab.prototype.ShowSearchMember =
function()
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
{
this.m_Panels[0].m_Element.style.display = 'none';
this.m_Panels[1].m_Element.style.display = 'inline';
![None.gif](http://www.cnblogs.com/Images/OutliningIndicators/None.gif?x-oss-process=image/resize,w_1400/format,webp)
};
可能算不上什么教训,但是还是可以注意几点。Coding的时候,因该:
多打些字;
查问题先查简单的;
实在不行了,散散步再回来做;
让team里的哥们给看一下...
本文转自博客园鸟食轩的博客,原文链接:http://www.cnblogs.com/birdshome/,如需转载请自行联系原博主。