怎么不能正常显示呀,你是对这个函数没有调用呀,当然没有反应了呀,对了你看看下面这个就是你的代码在我的机了上输出fibona的,我只加上php标志而已。不知道楼主的主要问题是什么。<?
function fenlei(){
global $prefix,$dbi,$r,$m,$s,$mtype,$stype;$rsel;
$count;
?>
<script language = "JavaScript">var onecount1;
onecount1=0;
rootcat = new Array();
<?php
$count=0;
$rsel="select distinct r,mtype,m from ".$prefix."_type order by m asc";
$result=mysql_query($rsel,$dbi);
while($row=mysql_fetch_array($result)){
?>
rootcat[<?php echo $count ?>] = new Array("<?php echo "document.write('trim($row[r])')"?>","<?php echo trim($row[mtype])?>","<?php echo trim($row[m])?>");
<?php
$count++;
}
?>
onecount1=<?php echo $count?>;var onecount2;
onecount2=0;
subcat = new Array();
<?php
$count = 0;
$rsel="select distinct m,stype,s from ".$prefix."_type order by s asc";
$result=mysql_query($rsel,$dbi);
while($row=mysql_fetch_array($result)){
?>
subcat[<?php echo $count ?>] = new Array("<?php echo trim($row[m])?>","<?php echo trim($row[stype])?>","<?php echo trim($row[s])?>");
<?php
$count++;
}
?>
onecount2=<?php echo $count?>;
function changem(locationid)
{
document.txForm.m.length = 0; var locationid=locationid;
var i;
for (i=0;i < onecount1; i++)
{
if (rootcat[i][0] == locationid)
{
document.txForm.m.options[document.txForm.m.length] = new Option(rootcat[i][1], rootcat[i][2]);
}
}
}function changes(locationid)
{
document.txForm.s.length = 0; var locationid=locationid;
var i;
for (i=0;i < onecount2; i++)
{
if (subcat[i][0] == locationid)
{
document.txForm.s.options[document.txForm.s.length] = new Option(subcat[i][1], subcat[i][2]);
}
}
}
</script>
<?
$selo;
$rsel="select distinct r,rtype from ".$prefix."_type order by r asc";
$result=mysql_query($rsel,$dbi);
if(!$row=mysql_fetch_array($result)){
echo "请先添加栏目。";
}
else{
echo "<select name='r' onChange='changem(document.txForm.r.options[document.txForm.r.selectedIndex].value)'>";
unset($result);
$result=mysql_query($rsel,$dbi);
while($row=mysql_fetch_array($result)){
if($row[r]==$r){
$selo="selected";
}
else{
$selo="";
}
echo "<option ".$selo." value='".trim($row[r])."'>".trim($row[rtype])."</option>";
}
}
echo "</select>";
echo "<select name='m' onChange='changes(document.txForm.m.options[document.txForm.m.selectedIndex].value)'>";
if($mtype<>""){
echo "<option selected value=".$m.">".$mtype."</option>";
}
else{
echo "<option selected value=>请选栏目</option>";
}
echo "</select>";
echo "<select name='s'>";
if($stype<>""){
echo "<option selected value=".$s.">".$stype."</option>";
}
else{
echo "<option selected value=>请选栏目</option>";
}
echo "</select><font color=red>**</font>";} //function end
?>
asdgasdgjkl;asdgklj;
function fenlei(){
global $prefix,$dbi,$r,$m,$s,$mtype,$stype;$rsel;
$count;
?>
<script language = "JavaScript">var onecount1;
onecount1=0;
rootcat = new Array();
<?php
$count=0;
$rsel="select distinct r,mtype,m from ".$prefix."_type order by m asc";
$result=mysql_query($rsel,$dbi);
while($row=mysql_fetch_array($result)){
?>
rootcat[<?php echo $count ?>] = new Array("<?php echo "document.write('trim($row[r])')"?>","<?php echo trim($row[mtype])?>","<?php echo trim($row[m])?>");
<?php
$count++;
}
?>
onecount1=<?php echo $count?>;var onecount2;
onecount2=0;
subcat = new Array();
<?php
$count = 0;
$rsel="select distinct m,stype,s from ".$prefix."_type order by s asc";
$result=mysql_query($rsel,$dbi);
while($row=mysql_fetch_array($result)){
?>
subcat[<?php echo $count ?>] = new Array("<?php echo trim($row[m])?>","<?php echo trim($row[stype])?>","<?php echo trim($row[s])?>");
<?php
$count++;
}
?>
onecount2=<?php echo $count?>;
function changem(locationid)
{
document.txForm.m.length = 0; var locationid=locationid;
var i;
for (i=0;i < onecount1; i++)
{
if (rootcat[i][0] == locationid)
{
document.txForm.m.options[document.txForm.m.length] = new Option(rootcat[i][1], rootcat[i][2]);
}
}
}function changes(locationid)
{
document.txForm.s.length = 0; var locationid=locationid;
var i;
for (i=0;i < onecount2; i++)
{
if (subcat[i][0] == locationid)
{
document.txForm.s.options[document.txForm.s.length] = new Option(subcat[i][1], subcat[i][2]);
}
}
}
</script>
<?
$selo;
$rsel="select distinct r,rtype from ".$prefix."_type order by r asc";
$result=mysql_query($rsel,$dbi);
if(!$row=mysql_fetch_array($result)){
echo "请先添加栏目。";
}
else{
echo "<select name='r' onChange='changem(document.txForm.r.options[document.txForm.r.selectedIndex].value)'>";
unset($result);
$result=mysql_query($rsel,$dbi);
while($row=mysql_fetch_array($result)){
if($row[r]==$r){
$selo="selected";
}
else{
$selo="";
}
echo "<option ".$selo." value='".trim($row[r])."'>".trim($row[rtype])."</option>";
}
}
echo "</select>";
echo "<select name='m' onChange='changes(document.txForm.m.options[document.txForm.m.selectedIndex].value)'>";
if($mtype<>""){
echo "<option selected value=".$m.">".$mtype."</option>";
}
else{
echo "<option selected value=>请选栏目</option>";
}
echo "</select>";
echo "<select name='s'>";
if($stype<>""){
echo "<option selected value=".$s.">".$stype."</option>";
}
else{
echo "<option selected value=>请选栏目</option>";
}
echo "</select><font color=red>**</font>";} //function end
?>
asdgasdgjkl;asdgklj;
解决方案 »
- 这条代码如何修改为用户名密码连接某个数据库表
- PHP语法问题
- 史上最牛B的缩放图width/XXX/height/XXX (XXX是数值) ,就可以得到不同的大小的图片,求解
- 大家帮帮忙啊,快急死了,谢谢!!!
- 偶是在IIS下配置的PHP环境可没用几天就出了一堆错,大家帮忙看看是什么问题
- 一个可动态调整行数的表格,如何把其所有数据都存到MYSQL里去?求思路
- 怎样根据设置的字体和字体大小计算所占用表格的宽度和高度????
- 请教关于php5配置的问题
- 如何多个用户共享一个session
- 求PHP和ASP连接SQL SERVER的程序
- 关于session.name的一个问题
- 很焦急,期盼高手的回答
function fenlei(){
global $prefix,$dbi,$r,$m,$s,$mtype,$stype;$rsel;
$count;
?>
<script language = "JavaScript">var onecount1;
onecount1=0;
rootcat = new Array();
<?php
$count=0;
$rsel="select distinct r,mtype,m from ".$prefix."_type order by m asc";
$result=mysql_query($rsel,$dbi);
while($row=mysql_fetch_array($result)){
?>
rootcat[<?php echo $count ?>] = new Array("<?php echo "document.write('trim($row[r])')"?>","<?php echo trim($row[mtype])?>","<?php echo trim($row[m])?>");
<?php
$count++;
}
?>
onecount1=<?php echo $count?>;var onecount2;
onecount2=0;
subcat = new Array();
<?php
$count = 0;
$rsel="select distinct m,stype,s from ".$prefix."_type order by s asc";
$result=mysql_query($rsel,$dbi);
while($row=mysql_fetch_array($result)){
?>
subcat[<?php echo $count ?>] = new Array("<?php echo trim($row[m])?>","<?php echo trim($row[stype])?>","<?php echo trim($row[s])?>");
<?php
$count++;
}
?>
onecount2=<?php echo $count?>;
function changem(locationid)
{
document.txForm.m.length = 0; var locationid=locationid;
var i;
for (i=0;i < onecount1; i++)
{
if (rootcat[i][0] == locationid)
{
document.txForm.m.options[document.txForm.m.length] = new Option(rootcat[i][1], rootcat[i][2]);
}
}
}function changes(locationid)
{
document.txForm.s.length = 0; var locationid=locationid;
var i;
for (i=0;i < onecount2; i++)
{
if (subcat[i][0] == locationid)
{
document.txForm.s.options[document.txForm.s.length] = new Option(subcat[i][1], subcat[i][2]);
}
}
}
</script>
<?
$selo;
$rsel="select distinct r,rtype from ".$prefix."_type order by r asc";
$result=mysql_query($rsel,$dbi);
if(!$row=mysql_fetch_array($result)){
echo "请先添加栏目。";
}
else{
echo "<select name='r' onChange='changem(document.txForm.r.options[document.txForm.r.selectedIndex].value)'>";
unset($result);
$result=mysql_query($rsel,$dbi);
while($row=mysql_fetch_array($result)){
if($row[r]==$r){
$selo="selected";
}
else{
$selo="";
}
echo "<option ".$selo." value='".trim($row[r])."'>".trim($row[rtype])."</option>";
}
}
echo "</select>";
echo "<select name='m' onChange='changes(document.txForm.m.options[document.txForm.m.selectedIndex].value)'>";
if($mtype<>""){
echo "<option selected value=".$m.">".$mtype."</option>";
}
else{
echo "<option selected value=>请选栏目</option>";
}
echo "</select>";
echo "<select name='s'>";
if($stype<>""){
echo "<option selected value=".$s.">".$stype."</option>";
}
else{
echo "<option selected value=>请选栏目</option>";
}
echo "</select><font color=red>**</font>";} //function end
?>
fibona
global $prefix,$dbi,$r,$m,$s,$mtype,$stype;$rsel;
$count;?>
这是什么意思》???