简体   繁体   English

我想单击一个按钮,然后一次从已经制作好的程序中只执行一行代码。.(javascript)

[英]I want to click a button and execute just one line of code at a time from an already made program.. (javascript)

yeah, so can i do that? 是的,我可以这样做吗?

i have a program already written that has two functions.. and one is recursive.. so i want to know how can i execute just one line of code at a time by pressing a button.. i hope it's possible 我已经编写了一个程序,该程序具有两个功能..一个是递归的..所以我想知道如何通过按一个按钮一次只执行一行代码..我希望有可能

and also i'm doing this in a web page 而且我也在网页上这样做

this is my script.. it has no importance but just for you to make an idea.. 这是我的脚本..它不重要,只为您提供一个想法。

READ THIS... i don't want to debug it with firebug or whatever... i want to make this myself inside my program... i want to make the code execute 1 line at a time when i press a button..so basically im building my own debugger.. the graphical part is already done.. i only need to know how to do this.. 阅读此内容...我不想用Firebug或其他工具调试它...我想在程序中自己创建它...我想让代码在我按下按钮时一次执行1行。 .so基本上,我正在构建自己的调试器..图形部分已经完成..我只需要知道如何执行此操作即可。

                        function nod(){
                            var info;
                            var st;
                            var dr;
                        }
                        function help(){
                            var rad;
                        }

                        var h = new help();
                        h.rad = new nod();
                        h.rad = null;

                        function create(h,x)
                        {

                            if(h.rad==null)
                            {
                                h.rad = new nod();
                                h.rad.info = x ;
                                h.rad.st = h.rad.dr = null;
                            }
                            else{
                                if(x < h.rad.info){
                                    var h1;
                                    h1 = new help();
                                    h1.rad = h.rad.st;
                                    create(h1,x);
                                    h.rad.st = h1.rad;
                                }
                                else{ 
                                    var h2;
                                    h2 = new help();
                                    h2.rad = h.rad.dr;
                                    create(h2,x);
                                    h.rad.dr = h2.rad;
                                }
                            }


                        }

                        function read(h)
                        {


                            var input = [0,10,2,1,8,9,4,5,3,6,20,11,30,21,31,22,23,
                            ];
                            var i;
                            for(i=1;i<=16;i++)
                            {
                                create(h,input[i]);

                            }



                        }

                        read(h);

Open your site in Chrome and use the integrated script debugger to execute the script step by step after a breakpoint you set. 在Chrome中打开您的网站,并使用集成的脚本调试器在设置断点后逐步执行脚本。

But have at least a quick look at the whole box of tools I linked too to ensure you know what you can expect and use the best tool for your need. 但至少也要快速浏览一下我链接的整个工具箱,以确保您知道可以期望什么,并根据需要使用最佳工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM