<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="style.css" type=text/css rel=stylesheet>
<title>无标题文档</title>
</head>
<script language="JavaScript">
function Options(str)
{
//alert(str);
//s=Number(str)+1;
var n=str.indexOf(":")+1;//:前面是文号,后面是文件类别
var num=str.substring(0,--n);
var num1=Number(num);
var sortname=str.substring(++n,10000);
window.document.form_opt.num.value = num;
window.document.form_opt.sortname.value = sortname;
}
</script>
<style type="text/css">
<!--
.style1 {color: #666666}
-->
</style>
</head><body>
<form action="wenhao.php" method="post" name="form_opt">
<select name="select1">
<option value="1" selected>B教</option>
<option value="2">A教</option>
</select>
<select name="book" onChange="Options(window.document.form_opt.book.options[selectedIndex].value);">
<option selected>请选择教室
<?php
//Options(window.document.form_opt.book.options[selectedIndex].value);
$db=mysql_connect("localhost","root","333333") or die("数据库连接失败!");
mysql_select_db("wenjianku",$db);
$query="select * from tablename";
$result=mysql_query($query,$db);
while($data=mysql_fetch_object($result))
{
$tmpname=$data->sortname;
$sortnum=$data->sortnum;
echo '<option value='.$sortnum.':'.$tmpname.'>'.$tmpname.'</option>';
}
mysql_close($db);
?>
</select>
<input name="sortname">
<input type="text" name="num"> 号
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</form>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="style.css" type=text/css rel=stylesheet>
<title>无标题文档</title>
</head>
<script language="JavaScript">
function Options(str)
{
//alert(str);
//s=Number(str)+1;
var n=str.indexOf(":")+1;//:前面是文号,后面是文件类别
var num=str.substring(0,--n);
var num1=Number(num);
var sortname=str.substring(++n,10000);
window.document.form_opt.num.value = num;
window.document.form_opt.sortname.value = sortname;
}
</script>
<style type="text/css">
<!--
.style1 {color: #666666}
-->
</style>
</head><body>
<form action="wenhao.php" method="post" name="form_opt">
<select name="select1">
<option value="1" selected>B教</option>
<option value="2">A教</option>
</select>
<select name="book" onChange="Options(window.document.form_opt.book.options[selectedIndex].value);">
<option selected>请选择教室
<?php
//Options(window.document.form_opt.book.options[selectedIndex].value);
$db=mysql_connect("localhost","root","333333") or die("数据库连接失败!");
mysql_select_db("wenjianku",$db);
$query="select * from tablename";
$result=mysql_query($query,$db);
while($data=mysql_fetch_object($result))
{
$tmpname=$data->sortname;
$sortnum=$data->sortnum;
echo '<option value='.$sortnum.':'.$tmpname.'>'.$tmpname.'</option>';
}
mysql_close($db);
?>
</select>
<input name="sortname">
<input type="text" name="num"> 号
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</form>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货