douxiawei9318 2010-04-20 16:35
浏览 31

将所有内容和脚本加载到另一个内部

If you go to this page on our website: http://www.divethegap.com/scuba-diving-programmes-dive-the-gap/dahab-divemaster-training.html

The buttons at the bottom that say 'Beginner' 'Open Water Diver' etc.... They take you to another page where you have a series of options and can book.

We would like it so that rather than have to navigate to another page it loaded those options and all the scripts that make the calculations in a div on the first page. Depending on which button you press depends on which page it would load inside the div.

IFrame does not work as it does not dynamically resize when the collapsible panels are opened. AJAX script at dynamic drive. http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm does not work as none of the collapsible panels work, nor does the calculation script.

How can this be done. To sum it up it would be like turning the buttons at the bottom of the page into tabs that would display the content from the pages those buttons currently link through to.

Is this possible.

  • 写回答

1条回答 默认 最新

  • douniwan_0025 2010-04-20 16:41
    关注

    Use Jquery, get the data through the $.get() method and use that data to do $('#myDiv').html(data);

    E.g:

    HTML

    <a href="#" id="getData">Get data</a>
    <div id="myContainer"></div>
    

    JS

    $('#getData').click(function(){
        $.get('data.php', { section: 'mySection' }, function(data){
           $('#myContainer').html(data);
        });
    });
    

    PHP:

    <?php
        if($_GET['section'] === 'mySection') echo '<span style="font-weigth:bold;">Hello World</span>';
    ?>
    

    That's the easiest way to do it. If you need any help with $.get() and/or .html() look at here:

    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP