html部分:

<pre name="code" class="html"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="/css/dmcx.css"/>
<link type="text/css" rel="stylesheet" href="/css/duoxuan1.css"/>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/cxjl.js"></script>
<script type="text/javascript" src="/js/jquery_duoxuan1.js"></script>
<title>MYTITLE</title>
</head>
<body bgcolor="#fff">
<div id="div">
<div align="center" id="div2" >
<form id="form1" method="post" action="/Dyjsdp/dyjsdp">
<select id="college">
<option>---请选择学院---</option>
</select>
<select id="major">
<option>---请选择专业---</option>
</select>
<input type="submit" value="查询"/>
</form>
</div>
</body>
</html>


jquery部分:

<script type="text/javascript">
$(document).ready(function(){
//联动下拉菜单
$("#college").load("/dyjsdp/college");
$("#college").change(function(){
$("#major").load("/dyjsdp/major","college="+$(this).val());
});
$("#major").change(function(){
$("#classes").load("/dyjsdp/class","major="+$(this).val());
}); });
</script>

zend framework部分:

    //学院联动
public function collegeAction(){
//header("Content-Type:text/html;charset=utf-8");
header("Cache-Control:no-cache"); $colleges=new College();
$res=$colleges->fetchAll();
echo "<option>--请选择学院--</option>";
foreach ($res as $college){
echo "<option>".$college['name']."</option>";
}
exit();
}
//专业联动
public function majorAction(){
//header("Content-Type:text/xml;charset=utf-8");
header("Cache-Control:no-cache");
$college=$this->getRequest()->getParam("college");
//file_put_contents("G:/php/myenv/mylog.log",$college);
$majors=new Major();
$db=$majors->getAdapter();
$sql=$db->quoteInto("select m.name from college c,major m where c.id=m.college_id and c.name=?", $college);
$res=$db->query($sql)->fetchAll(); echo "<option>---请选择专业---</option>";
foreach ($res as $major){
echo "<option>".$major['name']."</option>";
}
exit();
}

最新文章

  1. PAT A 1018. Public Bike Management (30)【最短路径】
  2. 静态工厂方法VS构造器
  3. 多项目开发下的dll文件管理
  4. 导出word使用模版
  5. phonegap+emberjs+python手机店发展,html5实现本地车类别~
  6. 三种工厂模式的分析以及C++实现
  7. JPA常用注解(转载)
  8. OC语言的面向对象—类和对象、方法
  9. Java深入 - MyBatis的经常用法
  10. 如何让你的传输更安全——NIO模式和BIO模式实现SSL协议通信
  11. legend_noa 的 EMACS配置
  12. Golang之路【目录】
  13. nginx反向代理转发后页面上的js css文件无法加载【原创】
  14. npm install 报错ERR! 404 Not Found: event-stream@3.3.6
  15. Android学习笔记一:项目目录结构
  16. C#复制文件
  17. 【译文】Web Service 众所周知的问题
  18. peda的官方文档说明
  19. mac, start sublime from terminal
  20. JAVA基础补漏--内部类

热门文章

  1. 装nginx遇到的坑 未完待续
  2. Mysql数据库命令行输入错误怎么办
  3. 3.1 开始使用 redux
  4. 剑指offer第二版面试题3:二维数组中的查找(JAVA版)
  5. js 中typeof 检测数据类型的时候需要注意的小细节
  6. webpack4.x的使用历程
  7. 2019-4-26-VisualStudio-开发文件自定义工具单文件生成工具
  8. 如何恢复误删的OneNote页面
  9. 记录一次工作中jvm被linux杀死的调查
  10. 2019南京网络赛 D Robots 期望dp