1

发生 onChange 事件时,我正在尝试重新加载 iframe

这是我在标题中的 javascript 标签中得到的内容


`

function getSchedule(oEvent) { var n = document.getElementById("wantedTherapist"); var newn = n.options[n.selectedIndex].value; window.frames['schedule'].src = "schedule.php?therapist="+newn; }

`

然后是我的 iframe 标签


iframe id="schedule" name="schedule" src="schedule.php"></iframe>

最后是我的选择框


<select id="wantedTherapist" name="wantedTherapist" onchange="getSchedule(Event)">
?php
            $query = "SELECT
                    therapistTable.*
                    FROM
                    therapistTable
                    WHERE
                    therapistTable.activated = 'true'
                    ";
            $result = mysql_query($query) or die (mysql_error());
            while($array = mysql_fetch_assoc($result))
            {
            extract($array);
            echo "<option value=\"$username\">$username - $city</option>";
            }
?
</select>

我把箭头从 php 标签和第一个箭头从 iframe 上取下来,这样它就会有问题地显示出来。它在 iframe 中加载 schedule.php 但不发送变量,我做错了什么?感谢您提前提供任何建议

4

1 回答 1

1

iFrame 的 URL 设置为什么?您可以通过右键单击 iFrame 并选择“在新窗口中打开框架”来确认这一点(在 Firefox 中)

如果 URL 是schedule.php?therapist=,则错误在于您在此处发布的代码。如果 URL 包含 的值therapist,例如 ,schedule.php?therapist=bob则错误在 中schedule.php

于 2010-03-26T20:33:33.350 回答