<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default1.aspx.cs" Inherits="tool_Default1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>toolxp.cn域名/ip定位查询 .net2.0版</title>
    <link href="style.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript">
function checkIP()
{
    var ipArray,j;
    var ip=document.getElementById('ip').value.toLowerCase().replace("http://","");
    if(/[A-Za-z_-]/.test(ip)){
        if(!/^([\w-]+\.)+((com)|(net)|(org)|(gov\.cn)|(info)|(cc)|(com\.cn)|(net\.cn)|(org\.cn)|(name)|(biz)|(tv)|(cn)|(la))$/.test(ip)){
            alert("不是正确的域名");
            document.getElementById('ip').focus();
            return false;
        }
    }
    else{
        ipArray = ip.split(".");
        j = ipArray.length
        if(j!=4)
        {
            alert("不是正确的IP");
            document.getElementById('ip').focus();
            return false;
        }

        for(var i=0;i<4;i++)
        {
            if(ipArray[i].length==0 || ipArray[i]>255)
            {
                alert("不是正确的IP");
                document.getElementById('ip').focus();
                return false;
            }
        }
    }
}
</script>
</head>
<body>
<div class="out1">
        <form id="form2" runat="server" onsubmit="return checkIP();">

        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
   <asp:TextBox ID="ip" runat="server" Width="386px"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="查询" Width="135px"  /><br />
        &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
Toolxp.cn友情提示：请输入IP或域名，比如127.0.0.1或www.toolxp.cn,即可查询主机所在地 

    </form>

   </div> 
<div class="kong"></div>
<div class="out2">
    <asp:Label ID="Label1" runat="server"></asp:Label>
</div>

<div class="out">
调用IP查询方法：<script language="javascript" src="ip.aspx" type="text/javascript"></script>

<textarea name="myseo0" cols="121" rows="2" title="双击可拷贝代码!" class="seo_my_area" ondblclick="this.focus();this.select();window.clipboardData.setData('Text',this.value);alert('代码已复制到剪贴板');return true;"><script language="javascript" src="ip.aspx" type="text/javascript"></script></textarea>
</div>
<script type="text/javascript" src="http://js.tongji.cn.yahoo.com/404047/ystat.js"></script><noscript><a href="http://tongji.cn.yahoo.com"><img src="http://img.tongji.cn.yahoo.com/404047/ystat.gif"/></a></noscript>
</body>
</html>

