<iframe frameborder="1" name="kkk" height="100" width="100" src="about:blank"></iframe>
<button onClick="show()">show</button>
<input name="url" type="text">
<button onClick="goUrl()">go</button>
<script>
function goUrl(){
document.all.tags("iframe")[0].src = url.value
}
function show(){
showIt = kkk.document.title
if( showIt == "找不到服务器" || showIt == "无法找到网页"){
alert(showIt)
}
}
</script>

解决方案 »

  1.   

    <script language="javascript">
    function getURL(url)
    {
        var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        xmlhttp.open("GET",url,false);
        xmlhttp.send(null);
        if (xmlhttp.readyState==4)
          alert((xmlhttp.Status==200)?"存在":"不存在");
    }
    //user like this:
    getURL("http://localhost/1.asp");
    </script><a href="http://www.csdn.net/" onclick="getURL(this.href)">mm</a>