ds0409 2012-03-23 12:41
浏览 108
已采纳

在网页中创建指向iFrame的外部链接

I have a page with an iFrame in it. I want to be able to send links to people, that will open a page within that iFrame on my page.

The main (parent) page is called results.html The iFrame has the id "searchresults"

The page that I wan people to be able to open within that iFrame is results.php, but it would have a number of parameters in it (for example results.php?id=5)

How would I construct the link to send to people?

For example, would it be /results.html?target="searchresults";?results.php?id=5

I simply can't work it out!

  • 写回答

1条回答 默认 最新

  • dounao1856 2012-03-23 12:48
    关注

    What stops you from simply loading the iFrame and the main frame with the same GET parameters?

    Or the place where you add iFrame, simply add the GET parameters of the main page also to the iFrame and then check for their presence in the iFrame code?

    For example, I have a page:

    index.php
    

    In this page I have an iFrame with an URL:

    <iframe src="search.php"></iframe>
    

    If I make a search, then the main page would change:

    index.php?search=test
    

    Now when I am generating the iFrame URL, I check if that GET parameter exists, if it exists then I append it to iFrame URL:

    <iframe src="search.php?search=test"></iframe>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!