dtbl1231 2012-12-19 14:14
浏览 48

如何在新窗口弹出窗口中打开php插件中的此链接

I have this code for pinterest which I want to open in a popup window:

<a target="_blank" href="http://pinterest.com/pin/create/button/?url='.get_permalink().'&media='.wp_get_attachment_url( get_post_thumbnail_id() ).'&description='.get_the_title(  $post->ID ).'" class="sharebtn_pinterest" count-layout="horizontal"></a>';

It is a plugin for WordPress that I am editing.

Edit: Here is the code I would like to work but no popup opens

 {
    echo '<div class="bla"> 
    <a onClick="MyWindow=window.open("http://pinterest.com/pin/create/button/?url='.get_permalink().'&media='.wp_get_attachment_url( get_post_thumbnail_id() ).'&description='.get_the_title(  $post->ID ).',"MyWindow","width=600,height=500") class="sharebtn_pinterest" "/></a></div>';
}
  • 写回答

1条回答 默认 最新

  • douqiu0351 2012-12-19 14:23
    关注

    Some javascript to add:

    <script language="javascript" type="text/javascript">
    <!--
    function popitup(url) {
        newwindow=window.open(url,'name','height=200,width=150');
        if (window.focus) {newwindow.focus()}
        return false;
    }
    
    // -->
    </script>
    

    Edit your link to:

    <a onclick="return popitup("http://pinterest.com/pin/create/button/?url='.get_permalink().'&media='.wp_get_attachment_url( get_post_thumbnail_id() ).'&description='.get_the_title(  $post->ID ).'")"
        >Link to popup</a>
    

    Copied from here. 1st result. Did you try searching this on Google first?

    评论

报告相同问题?

悬赏问题

  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)