没有关于JavaScript的调试 [英] No debug on JavaScript

查看:68
本文介绍了没有关于JavaScript的调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.aspx页面,其中有一些JS代码。在按钮中,有

I have an .aspx page in which there is some JS code. In the button, there is

onClick:function(){
  debugger;
  ... }



这段代码昨天工作,我可以通过调试器。由于未知原因,代码破坏了,不再在调试器停止。可能的原因是什么?谢谢,如果你能提供帮助。

代码如下:


This piece of code worked yesterday, and I could go through the debugger. For an unknown reason, the code broke and no stop at debugger anymore. What could be the possible reason? Thanks if you can help.
Code is below:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SOEDefault.aspx.cs" Inherits="WebApplicationTest.SOEDefault" %>

<!DOCTYPE html>

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9" />
    <meta name="viewport" content="width=device-width,user-scalable=no"/>
    <!--The viewport meta tag is used to improve the presentation and behavior of the samples 
      on iOS devices-->
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>Dynamic Segmentation</title>

    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.3/js/dojo/dijit/themes/claro/claro.css" />
    <style type="text/css">
      html, body {
        height: 100%; width: 100%; margin: 0; padding: 0;
      }
    </style>
    
    <script type="text/javascript">
        dojoConfig = {
            parseOnLoad: true
        }
    </script>
      <script src="http://code.jquery.com/jquery-1.10.2.js"  type="text/javascript"></script>
      <script src="http://code.jquery.com/jquery-1.10.2.min.js"  type="text/javascript"></script>
    
    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.3"></script>
    
    <script type="text/javascript">
        dojo.require("esri.map");
        dojo.require("esri.toolbars.draw");
        dojo.require("dijit.dijit"); // optimize: load dijit layer
        dojo.require("dijit.layout.BorderContainer");
        dojo.require("dijit.layout.ContentPane");

        var map, toolbar, symbol, geomTask;
        var resizeTimer;
        var distanceNumber = 1609.344;  //Meters in a mile

        function init() {
            map = new esri.Map("map", { extent: new esri.geometry.Extent
                ({ xmin: -8614312, ymin: 4687051, xmax: -8536040, ymax: 4730894, spatialReference: { wkid: 102100} })
            });     // 26973

            dojo.connect(map, "onLoad", createToolbar);

            //add the basemap (replace with URL to your own map service)
            var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
            map.addLayer(basemap);
        }

        function createToolbar(themap) {
            dojo.connect(dijit.byId('map'), 'resize', function () {
                resizeMap();
            });

            toolbar = new esri.toolbars.Draw(map);

            dojo.connect(toolbar, "onDrawEnd", function (geometry) {
                addToMap(geometry);
                getMarkersFromServer(geometry);
            });
        }

        function addToMap(geometry) {
            toolbar.deactivate();
            map.showZoomSlider();
            var symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([46, 139, 87, 1]), 5);

            var graphic = new esri.Graphic(geometry, symbol);
            map.graphics.add(graphic);
        }
        function getMarkersFromServer(geometry) {

            // Set up SOE URL and parameters
            soeURL = "http://10.10.22.50:6080/arcgis/rest/services/Test/RailLRSDef/MapServer/exts/SOE_LRSSegment/Segment_Operation";

            polylineJson = dojo.toJson(geometry.toJson());

            var content = {
                'polyline': polylineJson,
                'LRSSegInput': routeId,
                'MeasureInputA': measureA,
                'MeasureInputB': measureB,
                'f': "json"
            };
            esri.request({
                url: soeURL,
                content: content,
                callbackParamName: "callback",
                handleAs: "json",
                load: function (response) {
                    drawResponseGeometries(response);
                },
                error: function (error) {
                    console.log(error);
                }
            });
        }

        function drawResponseGeometries(response) {

            var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 30,
               new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
               new dojo.Color([255, 255, 255, 1]), 3),
               new dojo.Color([46, 139, 87, 1]));

            var infoTemplate = new esri.InfoTemplate();
            var sr = map.SpatialReference;

            var i = 1;
            while (response[i]) {
                var x = response[i].x;
                var y = response[i].y;
                var point = new esri.geometry.Point(x, y, sr);
                var attr = { "marker": String(i) };

                // Have to create the text symbol in the loop or else text all resets on next pan
                var textSymbol = esri.symbol.TextSymbol("N/A");
                var font = new esri.symbol.Font("14pt", esri.symbol.Font.STYLE_NORMAL,
                    esri.symbol.Font.VARIANT_NORMAL, esri.symbol.Font.WEIGHT_BOLD, "Arial");
                textSymbol.setFont(font);
                textSymbol.setColor(new dojo.Color([0, 0, 0, 1]));
                textSymbol.setOffset(0, -8);
                textSymbol.setText(String(i));

                // Create a graphic from the point and add it to the map
                var currentGraphic = new esri.Graphic(point, symbol, attr, infoTemplate);
                var textGraphic = new esri.Graphic(point, textSymbol, null, null);
                map.graphics.add(currentGraphic);
                map.graphics.add(textGraphic);

                i++;
            }
        }

        function routeIdChange() {
            var newRouteId = dojo.byId("routeID").value;
            routeId = newRouteId;
        }

        //Handle resize of browser
        function resizeMap() {
            clearTimeout(resizeTimer);
            resizeTimer = setTimeout(function () {
                map.resize();
                map.reposition();
            }, 500);
        }

        dojo.addOnLoad(init);

        function onClickRow(detailUrl) {
            debugger;
        }

    </script>
  </head>

  <body class="claro">

<div id="mainWindow" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline'" style="width:100%; height:100%;">
    <div id="header" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'" 
        style="height:110px;text-align:left;font-weight:bold;font-size:14px;color:#400D12;overflow:hidden;">
      <span style="font-size: x-large">Dynamic segmentation SOE Application</span><p></p>
	  <p>Choose a Route ID and 2 Measure Vlaues, then draw a polyline.<br /></p>
      <span><p></p>
      Route ID: <select id="routeID"  önchange="routeIdChange()";> 
            <option selected='true'>A1</option> 
            <option>A2</option>
          </select> 
		       
      Measure A:     <input id="MeasureA" type="text" />
           
      Measure B:     <input id="MeasureB" type="text" />
           

       <button id="submitButton" data-dojo-type="dijit.form.Button" data-dojo-props="onClick:function(){

            debugger;   }" >
            Draw Polyline   </button>
      </span>
      <br />
    </div>
    <div id="map" data-dojo-type="dijit.layout.ContentPane" style="border:solid 2px #587498;margin:5px;" data-dojo-props="region:'center'">
    </div>
</div>
  </body>
</html>

推荐答案

如果你不能打破调试器,这表明onClick不再是有线的起来。我会先检查一下。
If you can't break on debugger, this suggests that the onClick is no longer wired up. I would start by checking that.


我在里面放了一个警告

I put an alert inside that.
<button id="submitButton" 

        data-dojo-type="dijit.form.Button" 

        data-dojo-props="onClick:function(){ alert('Hello'); debugger; }">
Draw Polyline
</button>



显示 alert 以及点击调试器,但显示一些问题 undefineddojo._scopeArgs = [undefined];



所以,检查一下。:)


It is showing the alert as well as it hits the debugger, but shows some issue that is undefineddojo._scopeArgs = [undefined];

So, check that. :)


这篇关于没有关于JavaScript的调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆