0

我想创建一个链接,我们称之为“星期一的日程”。当您单击该链接时,它会加载“Schedule”页面,并且“ajaxoutput”div 会预先填充“view_games_monday.php”,如下面的函数所示。

目前,与以下功能相关的链接位于“Schedule”页面上,该页面是具有“ajaxoutput”div 的相同页面。

document.getElementById('games_monday').onclick = function()
{
    callPage('view_games_monday.php',document.getElementById("ajaxoutput"));
}


<a href="#" id="games_monday">monday</a>

<div id="ajaxoutput">
</div>

那么如何设置“星期一的日程安排”链接以加载“日程安排”页面,并在“ajaxoutput”div 中预先填充“view_games_monday.php”?我的问题是“星期一的日程”链接不在“日程”页面上。

对不起所有的报价只是想清楚。

感谢您的帮助。

我已经尝试了以下方法,并且可以加载计划页面,但不能使用正确的 ajax 输出:

document.getElementById('schedule_monday').onclick = function()
    {
        location = "http://mydomain.com/schedule";
        this.document.location.href = location;
        window.onload = callPage('http://mydomain.com/view_games_monday.php',document.getElementById("ajaxoutput"));
    }
4

1 回答 1

0

根据我们的评论讨论,根据我对您想要的内容的理解,这是我的建议。

您只需要一个页面,index.php. 这是非常基本的,但传达了这一点:

<?php

$scheduleDay = (isset($_GET['day']) ? $_GET['day'] : 'monday');

if( $scheduleDay == "monday" ){
   print 'stuff for monday goes here';
}
else if( $scheduleDay == "tuesday" ){
   print 'stuff for tuesday goes here';
}

然后,在您的导航菜单中,只需使用:index.php?day=tuesday等。

当php文件检测到日期时,会打印相应的信息。甚至不需要 javascript。

您可以像我提到的那样让它更漂亮,并将所有时间表打印到页面上并使用 javascript 仅显示一天,但我认为这个示例是您正在寻找的。

于 2013-03-29T01:55:05.840 回答