douyi3676 2016-08-04 19:48
浏览 21
已采纳

控制窗口大小[重复]

This question already has an answer here:

I have this code in my site and I would like to control the size of the _target window. I believe I need to use onClick but I am not sure. Newbie here.

      <td class="recordCells"><?php echo '<a href="inventory/' . $row_rsInventory['PHOTO'] . '" target="_blank">' . '<img src="images/a-camera-icon.png"/>' . '</a>'; ?></td>          
</div>
  • 写回答

3条回答 默认 最新

  • 普通网友 2016-08-04 19:54
    关注

    Yes, you're right about having to use onClick.

    Your code should look like this:

    <td class="recordCells">
        <?php echo '<a href="inventory/' . $row_rsInventory['PHOTO'] . '" target="_blank" onClick="window.open(this.href, \'mywin\', \'width=500,height=500\'); return false;">' . '<img src="images/a-camera-icon.png"/>' . '</a>'; ?>
    </td>
    

    The slashes are for escaping the quotes, the rest is kind of self-explanatory. 'mywin' is the identifier for the window, in case you want to change the content later. We're returning false in the function, so the default click functionality is overriden.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译