代码:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<!-- Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
<!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
<!--[if lt IE 9]>
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->
<style type="text/css">
.container {
max-width: 700px;
}
.header {
text-align: center;
}
.header-title {
margin-top: 0;
}
.panel-body span {
padding: 8px;
font-size: 16px;
}
</style>
</head>
<body>
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
IP地址查询
</h3>
</div>
<div class="panel-body">
<input name="ip" id="ip" />
<button>查询</button>
</div>
</div><!--/panel-->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
查询结果
</h3>
</div>
<div class="panel-body">
<div id="ipinfo" ></div>
</div>
</div><!--/panel-->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
当前IP
</h3>
</div>
<div class="panel-body">
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script type="text/javascript">
document.write(returnCitySN["cip"]+','+returnCitySN["cname"])
//document.getElementById("form-control").value=returnCitySN["cip"];
</script>
</div>
</div><!--/panel-->
</div>
</div>
<div style="height: 20px"></div>
<footer class="footer">
<div align="center">
<p>
<!--<span>© Company 2016</span>-->
<span>声明:</span>
<span><a href="/">首页</a></span>
</p>
</div>
</footer>
</div>
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) -->
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
var ip=$("#ip").val();
$.get("http://www.cha128.com/api/ip/?ip=",{
ip:ip
},
function(data,status){
//alert("数据: \n" + data + "\n状态: " + status);
$("#ipinfo").html(data);
});
});
});
</script>
</body>
</html>
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询