| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 | <!DOCTYPE HTML><html>	<head>		<meta charset="utf-8"/>		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>		<meta name="HandheldFriendly" content="true"/>		<meta name="MobileOptimized" content="320"/>		<title>Hello H5+</title>		<script type="text/javascript" src="../js/common.js"></script>    	<script type="text/javascript">var url="http://www.dcloud.io/";var xhr=null;function xhrCreate() {	if ( xhr ) {		outLine( "xhr请求已创建" );		return;	}	outSet( "创建请求:" );	xhr = new plus.net.XMLHttpRequest();	xhr.onreadystatechange = function () {        switch ( xhr.readyState ) {            case 0:            	outLine( "xhr请求已初始化" );            break;            case 1:            	outLine( "xhr请求已打开" );            break;            case 2:            	outLine( "xhr请求已发送" );            break;            case 3:                outLine( "xhr请求已响应");                break;            case 4:                outLine( "xhr请求已完成");                if ( xhr.status == 200 ) {                	outLine( "xhr请求成功:"+xhr.responseText );                } else {                	outLine( "xhr请求失败:"+xhr.status );                }                break;            default :                break;        }	}	xhr.open( "GET", url );	xhr.send();}function xhrResponseHeader() {	if ( xhr ) {		if ( xhr.readyState != 4 ) {			outLine( "xhr请求未完成" );		} else if ( xhr.status != 200 ) {			outSet( "xhr请求失败:"+xhr.readyState );		} else {			outSet( "xhr请求响应头数据:" );			outLine( xhr.getAllResponseHeaders() );		}	} else {		outSet( "未发送请求" );	}}function xhrAbort() {	if ( xhr ) {		outSet( "取消请求" );		if ( xhr.readyState != 4 ) {			xhr.abort();		}		xhr = null;	} else {		outSet( "未发送请求" );	}}    	</script>		<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8"/>	</head>	<body>		<br/>		<ul class="dlist">			<li class="ditem" onclick="xhrCreate();">发送请求</li>			<li class="ditem" onclick="xhrResponseHeader();">获取所有响应头</li>			<li class="ditem" onclick="xhrAbort();">取消请求</li>		</ul>		<div id="outpos"/>	    <div id="output">XMLHttpRequest管理网络请求操作,可进行跨域网络数据请求。		</div>	</body></html>
 |