当我点击帖子时,它会打开一个随机的帖子,而不是我点击的帖子。
$postid = get_the_ID();
在我代码的开头。
下面是我在post图像周围的<a>
标记内的onlick=''
中使用的函数
<script type="text/javascript">
function wholeAd(){
var permalink = '<?php echo get_permalink($postid); ?>';
window.open(permalink, 'newwindow', 'width=900, height=650');
return false;
}
</script>
<div class="ad-box span3">
<a class="ad-image" onclick='wholeAd()'>
发布于 2015-10-15 23:19:01
以下是解决方案:
你不需要创建一个函数
<a href="<?php the_permalink(); ?>" onclick="window.open(this.href,'newwindow', 'width=900, height=650');return false;">
发布于 2015-10-16 15:38:44
对于弹出窗口,可以使用如下所示的内容
"<a href='javascript:OpenPopUpPageWithTitle('"+oListItem.get_item('Url').get_url()+"', 'NotificationCallback', "+oListItem.get_item('Width')+", "+oListItem.get_item('Height')+",'" + oListItem.get_item('Title') + "');'> " + oListItem.get_item('Title') + "</a>"
对于新窗口,您可以使用如下所示的内容
<a target='_blank' href='url' style='styles'>Title</a>
希望这会有帮助,如果它解决了你的问题,请将它标记为答案
https://stackoverflow.com/questions/33147355
复制相似问题