javascript解析返回的xml各式的字符串
<script>
var flags ;
if(window.XMLHttpRequest) {
XMLHttpReq = new XMLHttpRequest(); //firefox下执行此语句
}
else if(window.ActiveXObject) {
try{
XMLHttpReq = new ActiveXObject("Msxm12.XMLHTTP");
}catch(e){
try{
XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e) {}
}
}
XMLHttpReq.open("post","getDate.jsp",false);
XMLHttpReq.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded;charset=UTF-8");
XMLHttpReq.onreadystatechange = function () {
var statePending = XMLHttpReq.readyState;
if (statePending == 4&& XMLHttpReq.status==200)
{
if(window.ActiveXObject){
xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.async = false;
xmlDoc.loadXML(XMLHttpReq.responseText.replace(/(^\s*)/g, ""));
} else if (document.implementation&&document.implementation.createDocument){
XMLHttpReq.open("GET",XMLHttpReq.responseText.replace(/(^\s*)/g, ""),false);
XMLHttpReq.send(null);
xmlDoc = XMLHttpReq.responseXML;
//return new XMLSerializer().serializeToString(xmlDoc);
}
flags = xmlDoc.getElementsByTagName("content");
}
}
XMLHttpReq.send(null);
for(var i =0;i<flags.length;i++)
{
var content = flags[i]; //得一个content结
相关文档:
自定义控件中的页面代码:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="wcontrol.ascx.cs" Inherits="wcontrol" %>
<script type ="text/javascript">
function PopupCalendar(InstanceName)
{
///Global Tag
this.instanceName=InstanceName;
///Properties
this.separator="-"
t ......
解读PHP DOMDocument在解析XML文件中的作用
http://developer.51cto.com 2009-12-02 10:39 佚名 柳城博客 我要评论(0)
PHP DOMDocument的功能非常强大,我们在这篇文章中将介绍如何正确的运用PHP DOMDocument来进行XML文件的解析。希望对又需要的朋友有所帮助。
在使用PHP对XML文件进行解析的时 ......
<!-- xml格式
<foo xmlns="test">
<bar attr='a'></bar>
<bar attr='b'></bar>
<bar attr='c'></bar>
</foo>
-->
<?php
$dom = new DOMDocument();
if (!$dom->load('attr.xml'))
{
echo "load books.xml failed!<br>";
re ......
用Javascript可以实现对GridView中某一行选择,而无需进行页面的刷新。
首先要在GridView的onrowdatabound的event handler中为GridView中的每一行onclick绑定event handler (Javascript)。假如GridView代码如下:
<asp:GridView runat="server" id="GridViewCategory" Aut ......
Several programming languages implement a sprintf function, to output a formatted string. It originated from the C programming language, printf function. Its a string manipulation function.
This is limited sprintf Javascript implementation. Function returns a string formatted by the usual printf co ......