JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Servlet/JSP 討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 Re:[問題]即時多層下拉選單 [Re:ㄚ孝]
joshua





發文: 2
積分: 0
於 2004-11-17 17:27 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
範例找不到, 乾脆寫一個新的:

程式主體, 還是借用 browser 大大的程式, 只是做了點小修改, 成為可以隨時撈db的版本

這隻範例裡頭的 java script 只能在 ie 上面跑, 在mozilla上面會有問題, 有興趣可以改改看

main.jsp
1
2
3
4
5
6
7
8
9
10
<%@ page contentType="text/html; charset=Big5" import="java.sql.*,java.util.*,java.io.*"%>
<html>
  <head>
    <title>MAIN (main.jsp)</title>
  </head>
  <frameset rows="*%,50%" frameborder="NO" border="0" framespacing="0">
    <frame name="showFrame" src="show.jsp" frameborder="NO">
    <frame name="submitFrame" src="submit.jsp" >
  </frameset>
</html>


show.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<%@ page contentType="text/html; charset=Big5" import="java.sql.*,java.util.*,java.io.*"%>
 
<html>
<head>
<title> show </title>
</head>
 
<body>
<form name="form" onsubmit="false;">
 
<select name="select01" onChange="Javascript:changelist();">
<option value="1" selected>國別</option>
<option value="2">女演員</option>
</select>
                                                                              
<div id="newOption"></div>
 
</form>
</body>
</html>
 
<SCRIPT LANGUAGE="JavaScript">
<!--
function changelist()
{
    window.parent.submitFrame.form.select01.value = form.select01.value;
    window.parent.submitFrame.form.workingType.value = "search";
    window.parent.submitFrame.form.submit();
}
-->
</SCRIPT>


submit.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<%@ page contentType="text/html; charset=Big5" import="java.sql.*,java.util.*,java.io.*"%>
 
<%
String select01 = (String)request.getParameter("select01");
String workingType   = (String)request.getParameter("workingType");
%>
 
<html>
<head>
<title> submit </title>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function init()
{
  
<%
if( "search".equals(workingType) )
{
  /***********與DB查詢有關的部分省略***********/
  if( "1".equals(select01) )
    out.println("window.parent.showFrame.document.all.newOption.innerHTML='<select name=select02><option value=1>台灣<option value=2>中國</select>'");
  else 
    out.println("window.parent.showFrame.document.all.newOption.innerHTML='<select name=select02><option value=1>田麗<option value=2>葉祖媚</select>'");
}
%>  
  
}
-->
</SCRIPT>
<body onload="init();">
<form name="form" method="post" action="submit.jsp">
  <input type="hidden" name="select01" value="">
  <input type="hidden" name="workingType" value="">
</form>
</body>
</html>


DB的部分我省略掉了, 看需求自行修改


joshua edited on 2004-11-17 17:32
reply to postreply to post
話題樹型展開
人氣 標題 作者 字數 發文時間
81000 [精華] [問題]即時多層下拉選單 ㄚ孝 384 2003-06-07 09:05
78188 Re:[問題]即時多層下拉選單 browser 1054 2003-06-07 18:19
75124 Re:[問題]即時多層下拉選單 x3711699 138 2004-04-08 20:41
74936 Re:[問題]即時多層下拉選單 alanting 710 2004-04-11 01:41
78165 Re:[問題]即時多層下拉選單 AdaHsu 3345 2004-04-19 12:23
76040 Re:[問題]即時多層下拉選單 tsechun 95 2004-04-21 02:01
73199 Re:[問題]即時多層下拉選單 andowson 474 2004-08-01 11:07
72929 Re:[問題]即時多層下拉選單 yingssu 663 2004-08-01 19:48
72002 Re:[問題]即時多層下拉選單 ting626 38 2004-08-25 16:57
72067 Re:[問題]即時多層下拉選單 i22616899 2298 2004-09-04 17:55
71258 Re:[問題]即時多層下拉選單 GuanChih 175 2004-09-05 18:51
71992 Re:[問題]即時多層下拉選單 jonz 873 2004-09-12 10:27
65244 Re:[問題]即時多層下拉選單 pulse 1193 2005-04-18 23:22
69050 Re:[問題]即時多層下拉選單 joshua 1019 2004-11-17 16:02
69372 Re:[問題]即時多層下拉選單 joshua 2357 2004-11-17 17:27
75630 Re:[問題]即時多層下拉選單 ㄚ孝 61 2003-06-09 08:34
75856 Re:[問題]即時多層下拉選單 browser 135 2003-06-09 09:23
68081 Re:[問題]即時多層下拉選單 Madagascar 141 2004-12-04 02:06
67895 Re:[問題]即時多層下拉選單 yannru 360 2004-12-07 16:19
67759 Re:[問題]即時多層下拉選單 Madagascar 465 2004-12-07 21:20
67751 Re:[問題]即時多層下拉選單 small3 388 2004-12-13 09:52
68133 Re:[問題]即時多層下拉選單 EPHT 3599 2004-12-18 09:45
55516 Re:[問題]即時多層下拉選單 yulie 2015 2006-06-06 12:47
55234 Re:[問題]即時多層下拉選單 yulie 102 2006-06-06 13:21
55509 Re:[問題]即時多層下拉選單 estrelas 1620 2006-06-06 18:51
46301 Re:[問題]即時多層下拉選單 minichitina 1875 2007-05-05 16:25
46193 Re:[問題]即時多層下拉選單 eidson72 4781 2007-05-16 11:48
21088 Re:[問題]即時多層下拉選單 catte 1960 2011-06-27 14:44
20982 Re:[問題]即時多層下拉選單 bernardvai 54 2011-06-27 16:56
45774 Re:[問題]即時多層下拉選單 alvin0224 309 2007-05-16 14:54
45851 Re:[問題]即時多層下拉選單 eidson72 21 2007-05-16 15:41
75446 Re:[問題]即時多層下拉選單 ㄚ孝 75 2003-06-09 14:05
75409 Re:[問題]即時多層下拉選單 jackyliu 201 2003-06-22 02:06
45303 Re:[問題]即時多層下拉選單 minichitina 188 2007-05-31 08:33
45164 Re:[問題]即時多層下拉選單 minichitina 2335 2007-06-04 08:04
45633 Re:[問題]即時多層下拉選單 minichitina 2718 2007-06-07 08:00
21088 Re:[問題]即時多層下拉選單 catte 2014 2011-06-28 03:14
20945 Re:[問題]即時多層下拉選單 bernardvai 1202 2011-06-28 09:54
21055 Re:[問題]即時多層下拉選單 catte 2970 2011-06-28 11:36
20920 Re:[問題]即時多層下拉選單 bernardvai 545 2011-06-28 14:21
21006 Re:[問題]即時多層下拉選單 catte 146 2011-06-28 17:54
20933 Re:[問題]即時多層下拉選單 bernardvai 2904 2011-06-29 09:58
20885 Re:[問題]即時多層下拉選單 catte 43 2011-06-29 21:58
20772 Re:[問題]即時多層下拉選單 bernardvai 219 2011-06-30 14:40
20583 Re:[問題]即時多層下拉選單 catte 269 2011-07-13 10:41
20662 Re:[問題]即時多層下拉選單 bernardvai 660 2011-07-13 11:34
20080 Re:[問題]即時多層下拉選單 catte 4035 2011-08-15 09:35
20303 Re:[問題]即時多層下拉選單 jk47 288 2011-08-15 11:19
75384 Re:[問題]即時多層下拉選單 mousetail 89 2003-06-22 13:06
77017 Re:[問題]即時多層下拉選單 alanting 1777 2003-06-22 23:21
75546 Re:[問題]即時多層下拉選單 alanting 87 2003-06-22 23:24
21207 Re:[問題]即時多層下拉選單 catte 54 2011-06-27 04:33
74961 Re:[問題]即時多層下拉選單 evenlin 132 2003-08-02 00:55
77108 Re:[問題]即時多層下拉選單 anthonycs 301 2003-08-02 15:43
74600 Re:[問題]即時多層下拉選單 ajax0953 232 2004-03-31 15:05
74347 Re:[問題]即時多層下拉選單 shyan68 261 2004-04-07 18:11
72791 Re:[問題]即時多層下拉選單 yafeng 122 2004-07-29 10:53
68231 Re:[問題]即時多層下拉選單 javaer 216 2004-12-20 00:40
» JWorld@TW »  Servlet/JSP 討論區

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8