Iframe根据javascript和php进行更改

Iframe根据javascript和php进行更改,php,javascript,select,iframe,src,Php,Javascript,Select,Iframe,Src,我正试图在onChange事件发生时重新加载iframe 下面是我在标题中的javascript标记中得到的内容 ` function getSchedule(oEvent) { var n = document.getElementById("wantedTherapist"); var newn = n.options[n.selectedIndex].value; window.frames['schedule'].src = "schedule.php?t

我正试图在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; } `

`

功能getSchedule(oEvent) { var n=document.getElementById(“WantedHeather”); var newn=n.options[n.selectedIndex].value; window.frames['schedule'].src=“schedule.php?治疗师=“+newn; } `

然后是我的iframe标签

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

iframe id=“schedule”name=“schedule”src=“schedule.php”>
最后是我的选择框


<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
$query=“选择
治疗表*
从…起
治疗台
哪里
therapistTable.activated='true'
";
$result=mysql\u query($query)或die(mysql\u error());
而($array=mysql\u fetch\u assoc($result))
{
提取($数组);
回显“$username-$city”;
}
?


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

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


如果URL为
schedule.php?治疗师=
,则错误与您在此处发布的代码有关。如果URL包含
治疗师
的值,例如
schedule.php?治疗师=bob
,则错误出现在
schedule.php

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


如果URL为
schedule.php?治疗师=
,则错误与您在此处发布的代码有关。如果URL包含
治疗师
的值,例如,
schedule.php?治疗师=bob
,那么错误在
schedule.php

hmm框架的URL是schedule.php,无论所选项目是什么,这意味着我的JS有问题。我听说使用window.frames['schedule'].src是一种比document.getelementbyid更好的方法,因为更多的浏览器支持它。我是否需要在初始加载时不设置iframe的src?它与
document.getelementbyid(“schedule”).src=“schedule.php?治疗师=“+newn
而不是
window.frames['schedule'].src=“schedule.php?repeater=“+newn
所以我想我会用这个谢谢你先生!嗯,框架的url是schedule.php,无论所选项目是什么,这意味着我的JS有问题。我听说使用window.frames['schedule'].src是一种比document.getelementbyid更好的方法,因为更多的浏览器支持它。我是否需要在初始加载时不设置iframe的src?它与
document.getelementbyid(“schedule”).src=“schedule.php?治疗师=“+newn
而不是
window.frames['schedule'].src=“schedule.php?repeater=“+newn
所以我想我会用这个谢谢你先生!