很多朋友都在问题这个问题,大我都初学者了,今天我就把我自己的写的发出来吧,各位看了别笑啊.先看看php与js混合代码.
<script><br /> function GetObjId(ObjName)<br /> {<br /> //alert(document.all.tags('select')[i].name);<br /> for(i = 0; i < document.all.tags('select').length; i++)<br /> {<br /> if (document.all.tags('select')[i].name == ObjName) {return(i); break;}<br /> }<br /> return(-1);<br /> }</script>
function Do_ToDo_Change(ObjName1, ObjName2, StatInt)
{
//document.forms[0].elements[0].name
var id1, id2, tempstr, tempint
var my_array = new Array();
$list='';
for($i=1;$i
$osql ="Select * from gx_newtype where gx_masterid=$i";
$resul =mysql_query($osql) or die(mysql_error());
while($res =mysql_fetch_array($resul)){
$list=$list.$res['id'].'|'.$res['gx_typename'].',';
}
?>
my_array[] = '';
$list='';
}
?>
id1 = GetObjId(ObjName1);
id2 = GetObjId(ObjName2);
tempint = document.all.tags('select')[id2].length;
for(i = 1; i
if (document.all.tags('select')[id1].selectedIndex > StatInt - 1)
{
tempstr = my_array[document.all.tags('select')[id1].selectedIndex - 1].split(",");
for(i = 1; i
}
}
看了上面的代码后有些朋友可能会有些问号?就是这样怎么行呢?js怎么能和php这样放在一起呢,我想如果你真的提出这个问题了,我想你大概不明白,服务器端脚本在客户端脚本之前执行吧?现在明白了吗?
下面来看我们是怎么让它们级联的.
//这里是一级
//这里是子菜单 ,
我们来看看效果图吧:
注:原创文章,转载请注明:www.111cn.net

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version
Visual web development tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version
God-level code editing software (SublimeText3)