在VS2008环境下,安装了arcgisserver9.3后,可以用web map application模板创建网站.想对其稍作修改,但是遇到了下面的问题。关于javascript的问题。
问题如下:
问题1、下面程序中红色字体处是我添加的,单步调试的时候语句(1)this._addToResultsLink = '<a href="javascript: AddToTaskResults(0);">Add to Results</a>';(原有的)和语句(2)this._addxingongnengLink = '<a href="www.baidu.com/;">新增功能</a>';(我自己添加的)都执行了,但是运行的结果只显示了我添加的内容,我想让两个一起都显示出来怎么办?
问题2、我的连接只是想简单的连接一个网址,可以运行后连接的网址变为:请求的 URL: /Web Mapping Application1/www.baidu.com/;其中Web Mapping Application1是我建立的网站名称,怎样填写语句this._addxingongnengLink = '<a href="www.baidu.com/;">新增功能</a>'href的内容,使请求的URL直接为百度的网址呢?
identifyLocation : function (mapID, pointX, pointY, pointAttributes) {
this.identifyMapClientID = mapID;
var newPt = new ESRI.ADF.Geometries.Point(pointX,pointY);
var identifyMapPoint = newPt;
this.identifyAttributes = pointAttributes;
this.selectedIndex = 0;
this.selectedValue = "";
this._addedToResults = new Array();
if (pointAttributes) {
for (var a=0;a<pointAttributes.length;a++) {
this._addedToResults.push(false);
}
}
this.identifyComboBox = "<b>" + "There is no information available for this location." + "</b>";
this._dropDownList = "";
if (this.identifyAttributes.length==0)
{
this.identifyComboBox = "No Features Found";
this._addToResultsLink = "";
///yujuncai
this._addxingongnengLink = "";
this._layerInfo = ""; 
}
else if (this.identifyAttributes.length == 1) {// One layer
this.identifyComboBox = this._getTitle(0);
this.selectedValue = this._getLayerName(0);
this._addToResultsLink = '<a href="javascript: AddToTaskResults(0);">Add to Results</a>';
/// 自己添加的
this._addxingongnengLink = '<a href="www.baidu.com/;">新增功能</a>';
                       ///

                         this._layerInfo = this._getLayerInfo(0); 
} else {// multiple layers
var index = 0;
for (var x = 0; x < this.identifyAttributes.length; x++) { // get layer names
if (this._getLayerName(x)==this.selectedValue) {
index = x;
this.selectedIndex = x;
}
}
this.identifyComboBoxPopulate(index);
}
if (this.identifyComboBox.length==0) this.identifyComboBox = "<b>" + "No Features found at this location." + "</b>";

this.identifyMapTips = new ESRI.ADF.UI.IdentifyMapTips(this);
this.identifyMapTips.set_animate(false);
this.identifyMapTips.set_hoverTemplate(this.identifyComboBox);
this.identifyMapTips.set_maxheight(250);
this.identifyMapTips.set_width(275);
this.identifyMapTips.initialize();
var imcallout = $find(mapID+'_identifyicon');
if (imcallout!=null) {
this._map.removeGraphic(imcallout);
imcallout.dispose();
imcallout = null; 
}
this.identifyMapCallout = $create(ESRI.ADF.Graphics.GraphicFeature,
{"id":mapID+'_identifyicon',"geometry":identifyMapPoint,"symbol":new ESRI.ADF.Graphics.MarkerSymbol(this._identifyIcon,12,24),
"mapTips":this.identifyMapTips,
"attributes":pointAttributes[0]}); this.identifyMapCallout.get_symbol().set_imageFormat("png32");
if(this.waitIcon) { this._map.removeGraphic(this.waitIcon); }     
this._map.addGraphic(this.identifyMapCallout);
var callout = this.identifyMapTips.get_callout();
// populate, position, and show the inital display
if(this._lastExpanded && this.identifyAttributes.length>0) { this.identifyMapTips.expand(); }
else { this.identifyMapTips.collapse(); } this.identifyMapTips._setContent(this.identifyMapCallout.get_attributes());
this.identifyMapTips._dropDownBox.innerHTML = this._dropDownList;
this.identifyMapTips.setPosition(this.identifyMapCallout.get_geometry());
this.identifyMapTips.get_callout().show();

if(!this.onMapZoom) {
this._onMapZoom = Function.createDelegate(this, this.clearOutCallout );
this._map.add_zoomStart(this._onMapZoom);
}
this._processing = false;
},
identifyComboBoxPopulate : function (index){
var layerName = this.identifyMapClientID;
var layerNameSelected = this.identifyMapClientID;
var titleString = "";
this._layerInfo = "";
this._addToResultsLink = "";
///yujuncai
this._addxingongnengLink = "";
this._dropDownList = "";
if (index==null || index=="undefined") index = 0;
if (this.identifyAttributes.length==0) { 
this.identifyComboBox = "No Features Found";
this._addToResultsLink = "";
///yujuncai
this._addxingongnengLink = "";
} else if (this.identifyAttributes.length===1) {
titleString = this._getTitle(0);
this.identifyComboBox = titleString;
  if (!this._addedToResults[0])
      this._addToResultsLink = '<a href="javascript: AddToTaskResults(0);">Add to Results</a>';
      this._addxingongnengLink = '<a href="www.baidu.com/;">新增功能</a>';
} else {
titleString = this._getTitle(index);
this.identifyComboBox = '<div id="identifyTitleDiv" >';
var ie = (Sys.Browser.agent == Sys.Browser.InternetExplorer);
this.identifyComboBox += '<table id="identifyTitleText" style="border: solid 1px rgb(238, 238, 238);font-size: x-small; width: 225px;" onmouseover="showIdentifyDropdownButton()" cellspacing="0" cellpadding="0"><tr><td ><div id="identifyTitleTextHolder">&nbsp;' + titleString + '</div></td>';
            this.identifyComboBox += '<td align="' + (document.documentElement.dir=="rtl"?"left":"right") + '"><img id="identifyDropdownButton" src="images/dropdown-button.png" onmousedown="showIdentifyDropdown(\'' + this.get_id() + '\')" style="visibility: hidden" /></td></tr></table>';
// populate identifyCombobox
this._dropDownList = '<table id="identifyTitleDropdown" style="background-color: White; color: black; width: 100%; font-size: x-small;" cellspacing="0">';
for (var x = 0; x < this.identifyAttributes.length; x++) { // get layer names
layerName = this._getLayerName(x);
titleString =  this._getTitle(x);
// generate ComboBox selection list
this._dropDownList += '<tr><td onclick="selectIdentifyDropdownItem(\'' + this.get_id() + '\', ' + x + ', \'' + layerName + '\');" onmouseover="this.style.backgroundColor=\'#DDDDDD\'" onmouseout="this.style.backgroundColor=\'White\'" style="cursor: default">' + titleString + '</td></tr>';
}
this._dropDownList += '</table>';
if (!this._addedToResults[index])
    this._addToResultsLink = '<a href="javascript: AddToTaskResults(' + index + ');">Add to Results</a>';
this._addxingongnengLink = '<a href="./www.baidu.com/;">新增功能</a>';
}
if (this.identifyComboBox.length==0) {
this.identifyComboBox = "No Features found at this location.";
this._layerInfo = ""; 
} else {
this._layerInfo = this._getLayerInfo(index); 
}
if (this.identifyMapCallout) this.identifyMapCallout.set_attributes(this.identifyAttributes[index]);
},

解决方案 »

  1.   

    <script type="text/javascript">
    document.location.href="http://www.google.com"  
    </script>
      

  2.   

    非常感谢你的回复,可是现在我是在mapidentify.js文件下,不是“源”下面。
      

  3.   

    this._addToResultsLink = ' <a href="javascript: AddToTaskResults(0);">Add to Results </a>';
    /// 自己添加的
    this._addxingongnengLink = ' <a href="www.baidu.com/;">新增功能 </a>'; 看代码,只有一个 addToResultsLink ,你为何不写到一起呢?比如this._addToResultsLink = ' <a href="javascript: AddToTaskResults(0);">Add to Results </a> <a href="www.baidu.com/;">新增功能 </a>';这样不好吗?呵呵!
      

  4.   

    问题1、
    pass 太长了看不动...  sorry问题2、 
    this._addxingongnengLink = ' <a href="www.baidu.com/;">新增功能 </a>';
    改为 
    this._addxingongnengLink = ' <a href="http://www.baidu.com/;">新增功能 </a>';
      

  5.   

    老实说,我只看了一行就看不下去了,跟楼上所说访问外部网站需要加http 这是一个原因,然后你确定你赋给this._addxingongnengLink 有值吗?,编译后连接的href也是有地址的嘛?
      

  6.   

    是比较难读,话说LZ开发的是.NET项目么