| 啦啦啦啦...... <html> <head> <title>List</title> <meta http-equiv="Content-Type" content="text/html; charset=??????"> <? if( !( $link = mysql_connect('localhost','root','') ) ){ echo "Could not connect to local MySQL server."; } if( !mysql_select_db('article')) { mysql_close( $link ); echo "Could not select database <b>ParserSample</b>."; } $sql="select typeid,title from article_articles"; $query=mysql_query($sql,$link); //while($rs=mysql_fetch_array($query)){ // echo $rs[0];} ?> <script language = "JavaScript"> var onecount; onecount = 0; subcat = new Array(); <? $count=0; while($rs=mysql_fetch_array($query)){ ?> subcat[<?=$count;?>] = new Array("<?=$rs['typeid'];?>","<?=$rs['title'];?>"); <? $count++; } ?> onecount=<?=$count?>; function getCity(locationid) { document.FormData.City.length = 0;
var locationid=locationid; var i; document.FormData.City.options[0] = new Option('文章...',''); for (i=0;i < onecount; i++) { if (subcat[i][0] == locationid) { document.FormData.City.options[document.FormData.City.length] = new Option(subcat[i][1], subcat[i][0]); } } } </script> </head> <body> <form name="FormData" method="post" action=""> 分类:<select name="Province" onChange="getCity(document.FormData.Province.options[document.FormData.Province.selectedIndex].value);" size="1"> <option selected>请选择类别</option> <option value="4">1</option> <option value="2">2</option> </select> <select name="City" > <option selected value="">==文章名==</option> </select> <INPUT TYPE="submit"> </form> </body> </html> <? if(!empty($_POST['City'])){ echo $_POST['City']; } ?>
|