【发布时间】:2011-09-04 08:07:10
【问题描述】:
我有这个从我的数据库中提取的 php 文件
<?php
$cdb = new PDO('mysql:dbname=xxx;host=localhost', 'xxx', 'xxx');
foreach ($cdb->query("SELECT * FROM images ORDER BY posted DESC LIMIT 3") AS $img)
{
$twofirst = substr($img['hash'], 0, 2);
echo '
<a style="position: relative; display: block; height: 140px;" href="/booru/post/view/' . $img['id'] . '" target="_blank">
<img src="booru/timthumb.php?src=images/' . $twofirst . '/' . $img['hash'] . '&h=125&w=125&q=100" width="125px" style="border-style: none"/>
</a>
';
}
模板
<div class="section">
<div class="secondaryContent">
<h3>New Cosplays</h3>
<iframe marginwidth="0" marginheight="0" width="125px" height="400px" scrolling="no" frameborder=0 src="image.php">
</iframe>
</div>
</div>
有没有更好的方法可以让它工作?
如果我不添加 target="_blank" 它只是在 iframe 中打开页面,这不是我想要的
有人说要使用 AJAX,但如果有人能给我展示一个很棒的例子,我什至不知道如何开始。
感谢您的宝贵时间。
【问题讨论】:
-
我认为您可以使用其他一些目标来获得此效果。不记得具体是什么了,可以试试“_top”或“_parent”。
-
哈,你的右边_top作品真棒,非常感谢:D
-
我会将其添加为答案,以便您接受。
-
干杯我会在 7 分钟内 :P 太快了所以它再次表示感谢
标签: php javascript html ajax iframe