gpt4 book ai didi

php - Google+ 按钮未出现

转载 作者:行者123 更新时间:2023-12-01 04:25:37 26 4
gpt4 key购买 nike

以下是代码:-

    <script type="text/javascript">

var timer = 150;
var currentWindow;
$(document).ready(function()
{
$("#creditme").button({
icons: { primary: "ui-icon-check" }
}).hide();
$("#viewad").button({
icons: { primary: "ui-icon-play" }
}).hide();
$("#progressbar").progressbar({value: 0}).hide();

var time;
var id;
var title;
var url;

$('.googlep-advertisement').bind('click', function()
{
id = $(this).attr('id');
title = $(this).text();
url = $('#yturl-'+id).text();
timer = $('#ytime-'+id).text();
$("#dialog-message").dialog({
modal: true,
width: 700,
title: title,
resizable: false,
draggable: false,
beforeClose: function() { clearAd(); }
});
if (!$("#progressbar").is(":visible") && !$("#creditme").is(":visible"))
{
$("#viewad").show();
}
});


$("#viewad").bind('click',function() {
$.get("googlep_credit.php" + '?start=' + id);
$("#viewad").hide();
$("#progressbar").progressbar('value', 0).show();
currentWindow = window.open(url, 'videoad', 'height=480,width=640', false);
window.blur();
window.focus();
progresscount(timer);
});
$("#creditme").click(function() {
$.get("googlep_credit.php" + '?id=' + id);
$("#creditme").hide();
$("#dialog-message").dialog('close');
$("#"+id).parent().parent('tr').fadeOut('slow');
});
function progresscount(time)
{
if(time == 0)
{
if(isWindowClosed() == true)
{
alert('You closed the popup before timer reached zero or you are using popup-blocking software.');
$("#dialog-message").dialog('close');
}
else
{
$("#creditme").html('<g:plusone callback="plusone_vote" href="'+url'"></g:plusone>');
$("#creditme").show();
}
$("#progressbar").hide();
}
else
{
time--;
$("#progressbar").progressbar('value', parseInt((timer - time) * 100 / timer));
setTimeout(function() { progresscount(time) }, 100);
}
}
});

function isWindowClosed()
{
if (!currentWindow || typeof currentWindow == 'undefined' || currentWindow && currentWindow.closed)
{
return true;
}
else
{
return false;
}
}



function clearAd()
{

}
</script>
<style>
.dialog-message {

}
</style>

<div id="dialog-message" class="dialog-message" title="View Video" style="display:none">
<p>

<center>
<button id="viewad" style="ui-helper-hidden">Click here to view the video</button>
<div id="progressbar"></div>
<button id="creditme" style="ui-helper-hidden">Test</button>
</center>
</p>
</div>

代码没有问题。问题是:- http://dl.dropbox.com/u/14384295/70.jpeg

当使用谷歌浏览器检查元素检查时,代码显示为 http://dl.dropbox.com/u/14384295/71.jpeg

正确工作将显示为 > http://dl.dropbox.com/u/14384295/72.jpeg

看起来代码没有被该部分中的 google js 转换。如果我感到困惑,我很抱歉。

我可能错误地添加了“url”变量

最佳答案

我很确定您的问题出在这一行:

$("#creditme").html('<g:plusone callback="plusone_vote"></g:plusone>');

您正在动态添加 <g:plusone>运行 Google +1 脚本后的元素,因此没有任何反应。

要解决这个问题,只需从头开始将 +1 标记放入 html 中,以便 +1 脚本可以找到它并渲染它,并且只调用 $("#creditme").show();当你需要展示它时。

<button id="creditme" style="ui-helper-hidden">
<g:plusone callback="plusone_vote"></g:plusone>
</button>

如果您想在页面加载后动态更改 URL,check out the examples from the Google documentation 。它将允许您显式加载按钮。

关于php - Google+ 按钮未出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6695993/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com