在php中得到的数组,怎样在js中引用呢?
isaxu 2002-11-05 03:08:38 我想在js中调用php得到的movietype数组,可是直接调用好像不行啊~~
请各位大虾帮忙!多谢!!
<?php
session_start();
include "../common.inc.php";
$typeResult=pg_exec($PG_CONN,"select * from movietype;");
$count=pg_numrows($typeResult);
for($i=0;$i<$count-1;$i++)
{
$arrname=pg_fetch_array($typeResult,$i);
$typelevel = $arrname[1];
$type1 = $arrname[2];
$type2 = $arrname[3];
$type3 = $arrname[4];
$type4 = $arrname[5];
$movietype[$typelevel][$type2][$type3][$type4][$type5] = $arrname[0];
}
?>
<SCRIPT LANGUAGE=JavaScript>
<!--
function ChangeType()
{var i,selType1name;
selType1name=document.form1.selType1.option[selectedIndex].value;
iCount=0;
while (movietype[selType1name][iCount]!=null) iCount++;//计算选定一级目录的二级子目录个数
document.form1.selType2.length=iCount;//二级子目录的选项数
for (i=0;i<=iCount-1;i++)//下拉菜单的内容
document.form1.selType2[i]=new Option(movietype[selType1name][i]);
document.form1.selType2.focus()
}
-->
</SCRIPT>