Today i add the code "dojo.require("esri.diji.Popup");" it get the error "xhrFailed" IN IE 8I put the api in the local computer,what't wrong ?????????1!!!!!!!!!!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
<!--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>QueryTask with query geometry from another task</title>
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.1/jsapi/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.1/jsapi/js/esri/dijit/css/Popup.css">
<script type="text/javascript">var dojoConfig = {parseOnLoad: true};</script>
<script type="text/javascript" src="http://localhost/arcgis_js_api/library/3.1/jsapi/"></script>
<script type="text/javascript">
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("esri.tasks.query");
dojo.require("esri.tasks.geometry");
dojo.require("esri.diji.Popup");
var map;
/*Initialize map, buffer, & query params*/
function init() {
// var popup = new esri.dijit.Popup(null, dojo.create("div"));
// var popup = new esri.dijit.Popup({
// fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]))
// }, dojo.create("div"));
var startExtent = new esri.geometry.Extent({"xmin":542658.416722138,"ymin":72762.5001166421,"xmax":690341.583278327,"ymax":165987.499005236});
map = new esri.Map("mapDiv", { });
//listen for when map is loaded and then add query functionality
dojo.connect(map, "onLoad", initFunctionality);
var imageParameters = new esri.layers.ImageParameters();
imageParameters.format = "jpeg"; //set the image type to PNG24, note default is PNG8.
// dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost/ArcGIS/rest/services/ditu/MapServer", {"opacity":1, "imageParameters":imageParameters});
var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost/arcgis/rest/services/TuJB5/MapServer", {"opacity":1, "imageParameters":imageParameters});
map.addLayer(dynamicMapServiceLayer);
}
function initFunctionality(map) {
var queryTask = new esri.tasks.QueryTask("http://localhost/arcgis/rest/services/TuJB5/MapServer/1");
//identify proxy page to use if the toJson payload to the geometry service is greater than 2000 characters.
//If this null or not available the buffer operation will not work. Otherwise it will do a http post to the proxy.
// esri.config.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx";
// esri.config.defaults.io.alwaysUseProxy = false;
// Query
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["GEOOBJNUM"];
query.outSpatialReference = map.spatialReference;
var infoTempContent = ""
+ "<br/><A href='#' onclick='map.graphics.clear();getfeature();'>Remove Selected Features</A>";
//Create InfoTemplate for styling the result infowindow.
var infoTemplate = new esri.InfoTemplate("Block: ${GEOOBJNUM}", infoTempContent);
map.infoWindow.resize(275,190);
var currentClick = null;
// +++++Listen for map onClick event+++++
dojo.connect(map, "onClick", function(evt) {
map.graphics.clear();
map.infoWindow.hide();
currentClick = query.geometry = evt.mapPoint;
query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
queryTask.execute(query);
dojo.byId('messages').innerHTML = "<b>Executing Point Intersection Query...</b>";
});
var firstGraphic = null;
// +++++Listen for QueryTask onComplete event+++++
dojo.connect(queryTask, "onComplete", function(graphics) {
firstGraphic = graphics.features[0];
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new dojo.Color([100,100,100]), 3), new dojo.Color([255,0,0,0.20]));
firstGraphic.setSymbol(symbol);
// firstGraphic.setInfoTemplate(infoTemplate);
map.graphics.add(firstGraphic);
// map.infoWindow.setFeatures([ graphics ]);
// map.infoWindow.show(currentClick );
});
}
function getfeature()
{
if(map.infoWindow.isShowing){
alert("have the feature")
// var loc = map.infoWindow.getSelectedFeature().geometry;
// var lg=loc.rings.length;
//alert(lg);
// if(!map.extent.contains(loc)){
// map.infoWindow.hide();
// }
}
else
{
alert("No the feature");
}
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
Click on map to select census block group that intersects the map click and all block groups that touch selected group.
<div id="mapDiv" style="width: 850px; height:500px; position:relative;"></div>
<span id="messages"></span>
</body>
</html>