xmldocumentie-Javascript
我对Javascript中的XMLDocument对象有问题。它未定义或为空。我的aspx代码是xmldocumentie-Javascript,javascript,asp.net,xml,dom,Javascript,Asp.net,Xml,Dom,我对Javascript中的XMLDocument对象有问题。它未定义或为空。我的aspx代码是 <div id='tabs_<%= RowId %>_2'> <table id='hist_<%= RowId %>'> //RowID is a number </table> <xml id='hist_data_<%= RowId %>'> //RowID is a number
<div id='tabs_<%= RowId %>_2'>
<table id='hist_<%= RowId %>'> //RowID is a number
</table>
<xml id='hist_data_<%= RowId %>'> //RowID is a number
<%= GridData.ToString() %> //i have data in datagrid with xml format.
</xml>
</div>
我们的大多数客户使用IE9或更早版本的IE9。所以我在IE9中以兼容模式进行调试。不太确定,因为一些文档/博客建议从IE9中删除XMLDocument。有谁能建议我解决这个问题的最佳方法吗
编辑:
GridData xml设置-C背后的代码#
GridData=newxdocument(new-XElement(“root”),rows=new-XElement(“rows”);
foreach(Call.StatusList中的Chronos.Messaging.CallStatus cs)
{
长s=cs.持续时间;
字符串持续时间=”;
如果(s>0)
duration=String.Format(@“{0:m:ss}”,新的日期时间(s*10000000));
bool rec=!String.IsNullOrEmpty(cs.MessageId);
双重评级=管理员?WebServiceHelper.GetWebService().getCallRating(cs.ID):0;
行。添加(
新XElement(“行”,
新XElement(“cell”,cs.Timestamp.ToString(“dd/MM/yy HH:MM:ss”),
新XElement(“cell”,cs.AgentName),
新的XElement(“单元格”,cs.Incoming?(字符)0x2713:“”),//0x2713是记号
新的XElement(“cell”,电话号码格式号码(cs.NumberCalled)),
新元素(“单元”,持续时间),
新元素(“单元格”,记录和调查?”:cs.DialResultDescription),
新元素(“单元格”,调查?”:cs.Info),
新的XElement(“单元格”,评级>0?String.Format(@“”,rating.ToString(),cs.ID,Call.ID):String.Format(@“”,cs.ID,Call.ID))
));
}
我不知道HTMLAllCollection在任何浏览器中都有或继承了名为XMLDocument的属性。是的,有一个,但IE9删除了该属性。供参考:
function showCall(row_id){
$("#hist_" + row_id).jqGrid({
datatype: "xmlstring",
datastr: document.all("hist_data_" + row_id).XMLDocument.xml // XMLDocument is undefined or null
});
}
GridData = new XDocument(new XElement("root", rows = new XElement("rows")));
foreach (Chronos.Messaging.CallStatus cs in Call.StatusList)
{
long s = cs.Duration;
string duration = "";
if (s > 0)
duration = String.Format(@"{0:m:ss}", new DateTime(s * 10000000));
bool rec = !String.IsNullOrEmpty(cs.MessageId);
double rating = Admin ? WebServiceHelper.GetWebService().getCallRating(cs.ID) : 0;
rows.Add(
new XElement("row",
new XElement("cell", cs.Timestamp.ToString("dd/MM/yy HH:mm:ss")),
new XElement("cell", cs.AgentName),
new XElement("cell", cs.Incoming ? (char)0x2713 : ' '), // 0x2713 is tick mark
new XElement("cell", TelephoneNumberFormatter.Number(cs.NumberCalled)),
new XElement("cell", duration),
new XElement("cell", rec & !survey ? "<a href='Listen.aspx?id=" + cs.MessageId + "'>" + cs.DialResultDescription + "</a>" : cs.DialResultDescription),
new XElement("cell", survey ? "" : cs.Info),
new XElement("cell", rating > 0 ? String.Format(@"<input type=""button"" value=""{0} %"" onclick=""window.open('CallRating.aspx?callStatusID={1}&callID={2}','Rating','status=1,resizable=1,scrollbars=1,width=590,height=650');return false;"" />", rating.ToString(), cs.ID, Call.ID) : String.Format(@"<input type=""button"" value=""Rate"" onclick=""window.open('CallRating.aspx?callStatusID={0}&callID={1}','Rating','status=1,resizable=1,scrollbars=1,width=590,height=650');return false;"" />", cs.ID, Call.ID))
));
}