123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <%@ 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>
|