Provides a simple jquery Implementation of level-2 cascade menu code download. After downloading the code, you can download a plug-in from jquery.
Provides a simple jquery Implementation of level-2 cascade menu code download. After downloading the code, you can download a plug-in from jquery.
<Script src = "../admin/js/jquery/jquery-1.2.6.js" type = "text/javascript"> </script>
<Script language = "javascript">
$ (
Function (){
$ ("# Collegeid"). change (
Function (){
$ ("# Professional"). load ("plugins/mycollege/mycollege_select.inc.php? Collegeid = "+ $ (" # collegeid "). val ());
}
);
}
);
</Script>
// Note that the names of all tags are based on id
<Select name = "collegeid" id = "collegeid">
<Option value = "0"> select a department </option>
<! -- {Loop $ all_colleges $ college} -->
<Option value = "$ college ['id']"> $ college ['name'] </option>
<! -- {/Loop} -->
</Select>
// The span tag in this area can be changed to div
<Span id = "professional">
<Select name = "professionalid" id = "professionalid">
<Option value = "0"> select a major </option>
</Select>
</Span>
3> the Load file outputs a file.
<? Php
Require_once '.../../include/common. inc. php ';
Require_once 'mycollege. function. php ';
// Determine whether the user is logged on
If (! $ Discuz_uid)
{
Showmessage ('not _ loggedin', 'logging. php? Action = login ');
}
// Here are some of my own database operations, which can be changed to my own data operations as needed
$ Collegeid = intval ($ collegeid );
$ Professionallist = getProfessionallist ($ collegeid );
Header ("Cache-Control: no-cache ");
$ Str = "<select name = 'your sionalid' id = 'your sionalid'> <option value = '0'> select a major </option> ";
If (! Empty ($ professionallist )){
Foreach ($ schemsionallist as $ value)
{
$ Str. = '<option value = "'. $ value [" id "]. '">'. $ value ["name"]. '</option> ';
}
}
$ Str. = '</select> ';
Echo $ str;
?>
Jquery plugin