首页 新闻 会员 周边 捐助

怎么调试js

0
悬赏园豆:5 [已关闭问题] 关闭于 2015-10-10 10:04

private void RegJs()
    {

        string strJS = @"
       <script type='text/javascript'>      
            function IsInHidden(CodeID) {
                var hidCodeValue = document.getElementById('" + hidValue.ClientID + @"').value;               
                return hidCodeValue.indexOf('' + CodeID + ',', 0) != -1;
            }
            function cboxSelectCheck(cboxSelect) {  
                IsCheckSelectAll(document.getElementById('chkSelectAll'),'gvList');      
                if (IsInHidden(cboxSelect.value)) {
                    document.getElementById('" + hidValue.ClientID + @"').value = document.getElementById('" + hidValue.ClientID + @"').value.replace(cboxSelect.value + ',', '');              
                }
                else {
                    document.getElementById('" + hidValue.ClientID + @"').value += '' + cboxSelect.value + ',';                   
                }
            }
            //确定按钮返回用户ID和用户名
            function ReturnValues() {
                var str = document.getElementById('" + hidValue.ClientID + @"').value;
                if (str =='') {
                    alert('请选择奶牛');
                    return false;
                }
                var substr1 ='';
                var substr2 ='';
                var L ='\'';
                var R ='\'';
                str = str.substring(0, str.length - 1);
                var arr = new Array();
                arr = str.split(',');
                for (var i = 0; i < arr.length; i++) {
                    //用户ID
                    substr1 += L + arr[i].split(';')[0] + R + ',';
                    //用户名
                    substr2 += arr[i].split(';')[1] + ',';
                }
                substr1 = substr1.substring(0, substr1.length - 1);
                substr2 = substr2.substring(0, substr2.length - 1);
                str = substr1 + ';' + substr2;
                window.returnValue = str;
                window.close();
            }
        </script> ";
        if (!ClientScript.IsClientScriptBlockRegistered(this.GetType(), "JS"))
            ClientScript.RegisterClientScriptBlock(this.GetType(), "JS", strJS);
    }

断点进不去js中,怎么调试

lctk的主页 lctk | 初学一级 | 园豆:69
提问于:2015-07-25 12:26
< >
分享
所有回答(3)
0

断点不行,在代码里加debugger。

funciton test(){

->debugger; //然后调试,会在这里断点

   var i, j;

   ...

}

liqipeng | 园豆:1160 (小虾三级) | 2015-07-25 13:58
0

浏览页面的时候,,点击f12....或者火狐的firebug..都可以啊。。。

Vip灬cnblog | 园豆:133 (初学一级) | 2015-07-26 20:43
0

可以用alert()提示框来调试,如果代码没有错误提示框是会弹出来的,反之是不会弹出来。

猿哥爱码 | 园豆:258 (菜鸟二级) | 2015-08-27 01:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册