My Opera is closing 1st of March

Linux夜航船

Everything should be easy.

Subscribe to RSS feed

用Ajax检测网址是否有效

javascript ->

function createXMLHttpRequest(){
if(window.ActiveXObject)
return new ActiveXObject("Microsoft.XMLHTTP");
else if(window.XMLHttpRequest)
return new XMLHttpRequest();
else return null;
}
function checkUrl(url){
var xmlHttp;
xmlHttp=createXMLHttpRequest();
if (xmlHttp){
xmlHttp.onreadystatechange=function(){handleStateChange(xmlHttp,document.getElementById('urlStatus'))};
xmlHttp.open("HEAD",url,true);
xmlHttp.send(null);
}
}
function handleStateChange(xmlHttpObj,toShow){
if(xmlHttpObj.readystate==4)
toShow.value=xmlHttpObj.statusText;
}

html ->

<p>
<input type="text" id="urlInput"> <input type="button" value="check ->" onclick="checkUrl(urlInput.value)"> <input type="text" id="urlStatus">
February 2014
S M T W T F S
January 2014March 2014
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28