|
@@ -0,0 +1,151 @@
|
|
|
+<%@ page language="java" contentType="text/html; charset=UTF-8"
|
|
|
+ pageEncoding="UTF-8"%>
|
|
|
+<%@ page import="java.util.*" %>
|
|
|
+<%@ page import="com.it.bean.*" %>
|
|
|
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
|
|
+<!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=UTF-8" />
|
|
|
+<title>SimpleTree</title>
|
|
|
+<link rel="stylesheet" type="text/css" href="js/tree_themes/SimpleTree.css"/>
|
|
|
+<link rel="stylesheet" href="js/tree_themes/style.css" media="screen" type="text/css" />
|
|
|
+<script type="text/javascript" src="js/jquery-1.6.min.js"></script>
|
|
|
+<script type="text/javascript" src="js/SimpleTree.js"></script>
|
|
|
+<script type="text/javascript">
|
|
|
+$(function(){
|
|
|
+ $(".st_tree").SimpleTree({
|
|
|
+ click:function(a){
|
|
|
+ if(!$(a).attr("hasChild"))
|
|
|
+ alert($(a).attr("ref"));
|
|
|
+ }
|
|
|
+ });
|
|
|
+});
|
|
|
+ window.onload = function () {
|
|
|
+ var add = document.getElementById("add");
|
|
|
+ add.onclick = function(){
|
|
|
+ prompt("请添加课程:");
|
|
|
+ }
|
|
|
+
|
|
|
+ var txt = document.getElementById("txt");
|
|
|
+ txt.onfocus = function(){
|
|
|
+ if (txt.value == "请输入关键字"){
|
|
|
+ txt.value = "";
|
|
|
+ txt.style.color = "#333";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ txt.onblur = function () {
|
|
|
+ if (txt.value == ""){
|
|
|
+ txt.value = "请输入关键字";
|
|
|
+ txt.style.color = "#ccc";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //获取图片
|
|
|
+ var img = document.getElementsByName("img");
|
|
|
+ //鼠标经过图片
|
|
|
+ for(i=0;i<img.length;i++){
|
|
|
+ if(i%3==0){
|
|
|
+ img[i].onmouseover = function () {
|
|
|
+ this.src = "js/tree_themes/imgs/" + 1 + ".gif";
|
|
|
+ }
|
|
|
+
|
|
|
+ img[i].onclick = function(){
|
|
|
+ $($(this).attr("id")+"form").style.display='block';
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if(i%3==1){
|
|
|
+ img[i].onmouseover = function () {
|
|
|
+ this.src = "js/tree_themes/imgs/" + 2 + ".gif";
|
|
|
+ }
|
|
|
+
|
|
|
+ img[i].onclick = function(){
|
|
|
+ var name = $(this).attr("id");
|
|
|
+ if(confirm("确实要删除吗?")){
|
|
|
+ window.location.href="DeleteServlet?name="+name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(i%3==2){
|
|
|
+ img[i].onmouseover = function () {
|
|
|
+ this.src = "js/tree_themes/imgs/" + 3 + ".gif";
|
|
|
+ }
|
|
|
+
|
|
|
+ img[i].onclick = function(){
|
|
|
+ alert($(this).attr("id"));//获取到了id
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ img[i].onmouseout = function () {
|
|
|
+ this.src = "js/tree_themes/imgs/0.png";
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+<div align="center">
|
|
|
+ <img id="school" src="js/tree_themes/imgs/school.png">
|
|
|
+</div>
|
|
|
+
|
|
|
+<div id="box">
|
|
|
+ <input type="text" name="search" value="请输入关键字" id="txt">
|
|
|
+ <div id="add">添加学科</div>
|
|
|
+ <div id="search">搜索</div>
|
|
|
+</div>
|
|
|
+<div id="all">
|
|
|
+<div class="img">
|
|
|
+ <!-- <img id="img" src="js/tree_themes/imgs/0.png">
|
|
|
+ <img id="img" src="js/tree_themes/imgs/0.png">
|
|
|
+ <img id="img" src="js/tree_themes/imgs/0.png"> -->
|
|
|
+</div>
|
|
|
+<form action="DisciplineAddServlet" >
|
|
|
+ 学科名:<input type="text" name="discipline_name">
|
|
|
+ <input type="submit" value="添加学科">
|
|
|
+</form>
|
|
|
+<form action="CourseAddServlet">
|
|
|
+ 学科名:<input type="text" name="discipline_name">
|
|
|
+ 课程名:<input type="text" name="course_name">
|
|
|
+ <input type="submit" value="添加课程">
|
|
|
+</form>
|
|
|
+<div class="st_tree">
|
|
|
+<% Map<String,List<Course>> courseMap = (Map<String,List<Course>>)request.getAttribute("courseMap");
|
|
|
+ Set<String> courseKeySet = courseMap.keySet();
|
|
|
+ List<String> courseKeyList = new ArrayList<String>(courseKeySet);
|
|
|
+
|
|
|
+ for(int i = 0;i < courseKeyList.size();i++)
|
|
|
+ {
|
|
|
+ String discipline = courseKeyList.get(i);
|
|
|
+
|
|
|
+ List<Course> courseList = courseMap.get(discipline);
|
|
|
+
|
|
|
+ int size = courseList.size();
|
|
|
+%>
|
|
|
+ <ul>
|
|
|
+ <li><a href="#"><%=discipline%></a><img id="<%=discipline%>" name="img" src="js/tree_themes/imgs/0.png">
|
|
|
+ <img id="<%=discipline%>ds" name="img" src="js/tree_themes/imgs/0.png">
|
|
|
+ <img name="img" src="js/tree_themes/imgs/0.png">
|
|
|
+
|
|
|
+ <form id="<%=discipline%>form" action="" method="post" style="display: none">
|
|
|
+ <input type="text" name="course_name">
|
|
|
+ </form>
|
|
|
+
|
|
|
+ </li>
|
|
|
+ <ul>
|
|
|
+ <c:forEach items="<%=courseList%>" var="course">
|
|
|
+ <li><a href="#">${course.getCourse_name()}</a><img id="${course.getCourse_name()}x" name="img" src="js/tree_themes/imgs/0.png">
|
|
|
+ <img id="${course.getCourse_name()}cs" name="img" src="js/tree_themes/imgs/0.png">
|
|
|
+ <img name="img" src="js/tree_themes/imgs/0.png"></li>
|
|
|
+ </c:forEach>
|
|
|
+ </ul>
|
|
|
+ </ul>
|
|
|
+
|
|
|
+<%
|
|
|
+ }
|
|
|
+ %>
|
|
|
+</div>
|
|
|
+ <div id="photo">
|
|
|
+ <img src="js/tree_themes/imgs/a.jpg" width="300px" height="300px">
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+
|
|
|
+</body>
|
|
|
+</html>
|