<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebTest.WebForm2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="jquery-1.10.2.min.js"></script>
<script language="javascript" src="http://www.codefans.net/ajaxjs/jquery1.3.2.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div style="width: 900px; height: 900px; border: 1px solid #ccc; float: left;">
<span id="ip"></span>
<span id="add"></span>
</div>
<div style="width: 400px; height: 900px; border: 1px solid #ccc; float: left;">
<div id="test" style="margin-left: 150px; margin-top: 50px; cursor: pointer">
<a id="clickzan">
<img src="images/2)4CUE6)UI]ZCO@O(YH}`C0.png" /></a>
</div>
</div>
</div>
</form>
</body>
</html>
<script type="text/javascript">
$(function () {
$("#clickzan").click(function () {
getcookie("userip");
})
})
function getcookie(objname) {//获取指定名称的cookie的值
var arrstr = document.cookie.split("; ");
for (var i = 0; i < arrstr.length; i++) {
var temp = arrstr[i].split("=");
if (temp[0] == objname) {
alert("已点赞!");
} else {
jQuery(function ($) {
var url = 'http://chaxun.1616.net/s.php?type=ip&output=json&callback=?&_=' + Math.random();
$.getJSON(url, function (data) {
document.cookie = "userip=" + data.Ip;
});
});
alert("赞!");
}
}
}
</script>
看完记得点赞哦!!