⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 一个二级联动下拉框的jsp实现 - 逍遥游 -- it博客-中国最具人气的it博客-赛迪网it人家园.htm

📁 一个连接数据库实现级联的代码
💻 HTM
📖 第 1 页 / 共 3 页
字号:
  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-10-y-2007.html">2007年10月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-11-y-2007.html">2007年11月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-12-y-2007.html">2007年12月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-1-y-2008.html">2008年1月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-2-y-2008.html">2008年2月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-3-y-2008.html">2008年3月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-4-y-2008.html">2008年4月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-5-y-2008.html">2008年5月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-6-y-2008.html">2008年6月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-7-y-2008.html">2008年7月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-8-y-2008.html">2008年8月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-9-y-2008.html">2008年9月</A> 

  <LI><A 
  href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-m-10-y-2008.html">2008年10月</A> 
  </LI></UL></DIV><!--end archive--><!--begin search-->
<DIV class=box>
<H2>文章搜索</H2>
<FORM action=search.php? method=post><INPUT type=hidden value=2 name=step> 
<INPUT type=hidden value=3900 name=authorid> <INPUT type=hidden value=S 
name=sch_area> 
<DIV class=text style="OVERFLOW: hidden; WIDTH: 100%"><LABEL><INPUT class=ip 
size=15 name=keyword> <INPUT class=bt type=submit value=" Go " name=submit> 
</LABEL></DIV></FORM></DIV><!--end search--></DIV>
<SCRIPT language=JavaScript>function upleft(id){	var obj  = GE('bloglist');	var objs = obj.getElementsByTagName('li');	for (var i=0;i<objs.length;i++) {		if (objs[i].lastChild.tagName == 'ULS') {			if (objs[i].id==id) {				if (objs[i].lastChild.style.display != 'none') {					objs[i].lastChild.style.display = 'none';				} else {					objs[i].lastChild.style.display = '';				}			} else {				objs[i].lastChild.style.display = 'none';			}		}	}}function cgpic(aid){	var obj  = GE('photo_img');	var obja = obj.getElementsByTagName('a');	var objimg = obja[0].getElementsByTagName('img');	var newaid = GE(aid).src;	if (GE(aid).src) {		newaid = newaid.replace(/\_thumb/ig,'');		if (objimg[0].src=='' || objimg[0].src != newaid) {			objimg[0].src = newaid;		}				if (obja[0].href != objimg[0].src) {			obja[0].href = objimg[0].src;		}	}	return;}function externallinks() {	if (!document.getElementsByTagName) {		return;	} 	var obja = document.getElementsByTagName("a");	for (var i=0; i<obja.length; i++) {		var obj = obja[i];		if (obj.getAttribute("href") && obj.getAttribute("rel") == "external") {			obj.target = "_blank";		}	}}</SCRIPT>
<!--begin main-->
<DIV class=right id=main>
<DIV class=box>
<H2>日志文章</H2><!--begin-->
<DIV class=text>
<DIV style="MARGIN-TOP: -10px; FLOAT: right"><IMG 
src="一个二级联动下拉框的jsp实现 - 逍遥游 -- IT博客-中国最具人气的IT博客-赛迪网IT人家园.files/ncopy.jpg"></DIV>
<DIV style="MARGIN-TOP: -10px; FLOAT: right"><IMG height=40 
src="一个二级联动下拉框的jsp实现 - 逍遥游 -- IT博客-中国最具人气的IT博客-赛迪网IT人家园.files/recommend.gif" 
width=40></DIV>
<DIV class=gray>2006年01月14日 11:43:11</DIV>
<H3>一个二级联动下拉框的jsp实现 </H3>
<TABLE class=blog-content>
  <TBODY>
  <TR>
    <TD>
      <P>&lt;%@ page contentType="text/html; charset=gb2312" language="java" 
      errorPage="" 
      %&gt;<BR>&lt;html&gt;<BR>&lt;head&gt;<BR>&lt;title&gt;无标题文档&lt;/title&gt;<BR>&lt;script 
      language="JavaScript" type="text/JavaScript"&gt;<BR>var onecount; 
      <BR>onecount=0; <BR>subcat = new Array(); <BR>&lt;% &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dao da = 
      new Dao();<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; List smalllist = da.listObjs("from ProductSmallsort 
      as c where c.active='Y' "); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      if(smalllist!=null){<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int 
      j=0;j&lt;smalllist.size();j++){<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; ProductSmallsort pb = (ProductSmallsort) 
      smalllist.get(j);<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (pb != 
      null) {<BR>%&gt;<BR>subcat[&lt;%=j %&gt;] = new Array("&lt;%= 
      pb.getName()%&gt;","&lt;%=pb.getSmallsortid()%&gt;","&lt;%= 
      pb.getProductBigsort().getBigsortid() %&gt;"); <BR>&lt;% }} %&gt; 
      <BR>onecount=&lt;%=smalllist.size() %&gt;; <BR>&lt;% } 
      %&gt;<BR>&lt;!--决定select显示的函数--&gt; <BR>function changelocation(id) 
      <BR>&nbsp; { <BR>&nbsp; document.myform.smallid.length = 0; <BR>&nbsp; var 
      locationid=id; <BR>&nbsp; var i; <BR>&nbsp; &nbsp; 
      document.myform.smallid.options[0] = new Option('请选择产品小类','0');<BR>&nbsp; 
      for (i=0;i&lt;onecount;i++) <BR>&nbsp; &nbsp; { <BR>&nbsp; &nbsp; &nbsp; 
      &nbsp; if (subcat<I>[2] == locationid) <BR>&nbsp; &nbsp; &nbsp; &nbsp; { 
      <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      document.myform.smallid.options[document.myform.smallid.length] = new 
      Option(subcat<I>[0],subcat<I>[1]); <BR>&nbsp; &nbsp; &nbsp; &nbsp; } 
      &nbsp; &nbsp; <BR>&nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; <BR>&nbsp; } &nbsp; 
      <BR>&lt;/script&gt;<BR>&lt;meta http-equiv="Content-Type" 
      content="text/html; 
      charset=gb2312"&gt;&lt;/head&gt;<BR><BR>&lt;body&gt;<BR>&lt;form action="" 
      method="post" name="myform"&gt;<BR>&lt;table width="100%" 
      &gt;<BR>&lt;tr&gt;<BR>&nbsp; &lt;td width="20%" 
      align="right"&gt;大类:&lt;/td&gt;<BR>&nbsp; &lt;td&gt;<BR>&nbsp; &nbsp; 
      &lt;select name="bigid" &nbsp; 
      onChange="changelocation(document.myform.bigid.options[document.myform.bigid.selectedIndex].value)"&gt;<BR>&nbsp; 
      &nbsp; &lt;option value="0" selected&gt;请选择产品大类&lt;/option&gt;<BR>&lt;% 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; Dao dao = new Dao();<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List biglist = 
      dao.listObjs("from ProductBigsort as c where c.active='Y' "); &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; if(biglist!=null){<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int 
      i=0;i&lt;biglist.size();i++){<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      ProductBigsort yy = (ProductBigsort) biglist.get(i);<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; if (yy != null) {<BR>%&gt;<BR>&nbsp; &nbsp; 
      &lt;option value="&lt;%=yy.getBigsortid() %&gt;"&gt;&lt;%=yy.getName() 
      %&gt;&lt;/option&gt; &nbsp; &nbsp; <BR>&lt;% }}} %&gt;<BR>&nbsp; &nbsp; 
      &lt;/select&gt;<BR>&nbsp; &nbsp; 
      &lt;/td&gt;<BR>&lt;/tr&gt;<BR>&lt;tr&gt;<BR>&nbsp; &lt;td width="20%" 
      align="right"&gt;小类:&lt;/td&gt;<BR>&nbsp; &lt;td&gt;<BR>&nbsp; &nbsp; 
      &lt;% <BR>&nbsp; &nbsp; /*如果是修改的话,是这样的<BR>&nbsp; &nbsp; &lt;select 
      name="smallid"&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; 
      &lt;% if(smallid!=0&amp;bigid!=0){ %&gt;<BR>&nbsp; &nbsp; &lt;option 
      value="&lt;%= smallid %&gt;" selected&gt;&lt;%= smallName 
      %&gt;&lt;/option&gt;<BR>&nbsp; &nbsp; &lt;% } %&gt;<BR>&nbsp; &nbsp; 
      &lt;/select&gt; &nbsp; &nbsp; <BR>&nbsp; &nbsp; */<BR>&nbsp; &nbsp; 
      %&gt;<BR>&nbsp; &nbsp; &lt;select name="smallid" &gt;<BR>&nbsp; &nbsp; 
      &lt;option value="0" selected&gt;请选择产品小类&lt;/option&gt; &nbsp; &nbsp; 
      <BR>&nbsp; &nbsp; &lt;/select&gt;<BR>&nbsp; &nbsp; 
      &lt;/td&gt;<BR>&lt;/tr&gt;<BR>&lt;/table&gt;<BR>&lt;/form&gt;<BR>&lt;/body&gt;<BR>&lt;/html&gt;<BR></P></I></I></I></TD></TR></TBODY></TABLE>
<DIV class=bb>
<DIV>类别: <A 
href="http://blog.ccidnet.com/blog-htm-do-list-uid-3900-type-blog-dirid-712.html">观注java技术</A> 
| &nbsp;<A 
href="http://blog.ccidnet.com/blog-htm-do-showone-uid-3900-type-blog-itemid-18378.html#c">评论</A>(<SPAN 
id=sum>3</SPAN>) | &nbsp;<A 
href="http://blog.ccidnet.com/blog-htm-do-showone-uid-3900-type-blog-itemid-18378.html">浏览</A>(3940) 
| &nbsp;<A title=加入书签 style="CURSOR: pointer" 
onclick="addtoclt(18378,'blog');">收藏</A></DIV>
<DIV class=c></DIV></DIV><!--begin comment--><A name=mao></A>
<DIV class="comment bb">
<H5 id=cdisplay style="DISPLAY: none">一共有 <SPAN id=sums>3</SPAN> 条评论</H5><SPAN 
id=ajaxreply><A name=c0></A>
<SCRIPT>		  		var commentIds = new Array();		  </SCRIPT>

<SCRIPT>	commentIds.push('114119');</SCRIPT>
<A name=c114119></A>
<DL id=114119>
  <DD class="comment-pic left"><IMG 
  src="一个二级联动下拉框的jsp实现 - 逍遥游 -- IT博客-中国最具人气的IT博客-赛迪网IT人家园.files/none.jpg" 
  width=40> 
  <DD><SPAN style="FONT-WEIGHT: bolder; FONT-SIZE: 12px">3楼&nbsp;</SPAN><A 
  class="big b" 
  href="http://blog.ccidnet.com/blog-htm-do-showone-uid-3900-type-blog-itemid-18378.html#">[匿名]guest</A> 
  <SPAN class=gray>2006年12月21日 17:52:36</SPAN> Says: </DD>
  <DD class=comment-content>
  <DIV>能不能把例子的源代码传上来呀,我急用这个。谢谢了。</DIV></DD></DL>
<SCRIPT>	commentIds.push('67724');</SCRIPT>
<A name=c67724></A>
<DL id=67724>
  <DD class="comment-pic left"><IMG 
  src="一个二级联动下拉框的jsp实现 - 逍遥游 -- IT博客-中国最具人气的IT博客-赛迪网IT人家园.files/none.jpg" 
  width=40> 
  <DD><SPAN style="FONT-WEIGHT: bolder; FONT-SIZE: 12px">2楼&nbsp;</SPAN><A 
  class="big b" 
  href="http://blog.ccidnet.com/blog-htm-do-showone-uid-3900-type-blog-itemid-18378.html#">[匿名]guest</A> 
  <SPAN class=gray>2006年07月21日 10:54:49</SPAN> Says: </DD>
  <DD class=comment-content>
  <DIV>现在用ajax的也比较多</DIV></DD></DL>
<SCRIPT>	commentIds.push('41359');</SCRIPT>
<A name=c41359></A>
<DL id=41359>
  <DD class="comment-pic left"><IMG 
  src="一个二级联动下拉框的jsp实现 - 逍遥游 -- IT博客-中国最具人气的IT博客-赛迪网IT人家园.files/none.jpg" 
  width=40> 
  <DD><SPAN style="FONT-WEIGHT: bolder; FONT-SIZE: 12px">1楼&nbsp;</SPAN><A 
  class="big b" 
  href="http://blog.ccidnet.com/blog-htm-do-showone-uid-3900-type-blog-itemid-18378.html#">[匿名]guest</A> 
  <SPAN class=gray>2006年01月18日 10:49:03</SPAN> Says: </DD>
  <DD class=comment-content>
  <DIV>我也写了连动的东西,在Struts中的。觉得这玩意儿是够烦的。<BR>建议兄弟用Tag改写,不论是从代码阅览和维护的角度,都会好多<BR><BR>ArdorLeo<BR></DIV></DD></DL></SPAN><INPUT 
id=commentid type=hidden value=41359 name=commentid> 
<DIV class=big id=commentspage></DIV>
<FORM name=FORM>
<DIV class=post-comment>
<H5>发表评论</H5>
<DIV><A>用户名:</A><INPUT class=ip id=guestname tabIndex=1 size=22 name=guestname> 
</DIV>
<DIV><TEXTAREA class=ip id=content onkeydown=quickpost(event) style="WIDTH: 95%" tabIndex=4 name=content rows=10></TEXTAREA> 
</DIV>
<DIV><IMG id=ck style="CURSOR: pointer" 
onclick="javascript:newgdcode(ck,'ck.php?windid=guest');" alt=看不清楚,换一张 src="" 
align=absMiddle> <INPUT class=ip id=gdcode tabIndex=1 size=4 name=gdcode> <INPUT 
id=ifcode type=hidden value=guest> <INPUT class=bt id=csubmit onclick=postcomment(); tabIndex=5 type=button value="提 交" name=Submit valign="middle"> 
</DIV></DIV></FORM>
<SCRIPT language=JavaScript>var now = new Date();var ny = now.getYear();var nm = parseInt(now.getMonth())+1;nm = nm.toString();nm = LenthByByte(nm) < 2 ? '0' + nm : nm;var nd = now.getDate();var actdo  = 'showone';var nextid  = '114120';var nexturl = '#';var nextdate = ny + '年' + nm + '月' + nd  + '日';var nexticon = 'image/upload/none.gif';var allow = '0';var type = 'blog';</SCRIPT>

<DIV class=c></DIV></DIV><!--begin comment--></DIV><!--end--></DIV></DIV><!--end main--><BR 
class=c></DIV><!--<script language="JavaScript" src="http://image.ccidnet.com/ad_files/home_daohang/copyright_1128.js"></script>--></DIV></DIV></DIV>
<SCRIPT language=javascript src=""></SCRIPT>
<!-- ccidnet -->
<SCRIPT language=JavaScript type=text/javascript> var _PCSWebSite="100001"; var _PCSImage="countlogo1.gif";</SCRIPT>

<SCRIPT language=JavaScript 
src="一个二级联动下拉框的jsp实现 - 逍遥游 -- IT博客-中国最具人气的IT博客-赛迪网IT人家园.files/count.js" 
type=text/javascript></SCRIPT>
<!-- ccidnet --></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -