javascript的调试问题一直困扰我

有没有单步调试脚本的办法呢?

后经过人家指点,知道一简单方法随笔记录如下:

 

1。设置IE高级选项,把禁止调试去掉

javascript在vs2003中调试随笔和Fitch and Mather 7.0中javascript使用小总结[收藏] 

2。让后打开你要调试的页面

 

3。回到vs2003中,选择工具-调试进程--选择explorer.exe--附加--选择script确定

 javascript在vs2003中调试随笔和Fitch and Mather 7.0中javascript使用小总结[收藏]

4.选择debug-window-running document

这样就可以单步运行你的客户端脚本了

 javascript在vs2003中调试随笔和Fitch and Mather 7.0中javascript使用小总结[收藏]


Fitch and Mather 7.0项目中发现2个常用的javascript

1。页面启动时聚焦某一个文本框

 

例如页面中有一个文本框

<asp:textbox >start</asp:textbox>

 

加入下面的脚本

function window_onload()

{

       if (document.all.b)

       {

              document.all.b.select();

              document.all.b.focus();

       }

}

 

再添加

<body  onload="window_onload()">

 

2。文本框内容改变时的互清除内容

例如页面中有2个文本框

<asp:textbox ></asp:textbox>

<asp:textbox ></asp:textbox>

 

var inHandler=false;                                                               

function OnEditHandler()

{

       if(inHandler)

               return;

        inHandler=true;

       var srcId = event.srcElement.id;               

                               

       if( srcId == "a" )

       {                  

          document.all.b.value = "";                  

       }

       else if( srcId == "b" )

       {                  

          document.all.a.value = "";                  

       }

         inHandler=false;

}

 

这样当a中内容改变时,就清空b中的文本,同样当b中内容改变时,就清空a中的文本

相关文章:

  • 2021-08-28
  • 2021-07-09
  • 2022-12-23
  • 2021-04-03
  • 2021-07-28
  • 2021-10-31
猜你喜欢
  • 2021-07-04
  • 2022-12-23
  • 2022-01-24
  • 2022-02-19
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案