| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 370 人关注过本帖
标题:【小问题求解】
只看楼主 加入收藏
刘杰明
Rank: 8Rank: 8
来 自:山东大学威海校区
等 级:蝙蝠侠
帖 子:155
专家分:872
注 册:2011-6-20
结帖率:63.64%
收藏
 问题点数:0 回复次数:3 
【小问题求解】
<table  align="center"width="392" height="230" border="0" cellpadding="0" cellspacing="0">
<form name="myform">
  <tr>
    <td bgcolor="#FF9999"><div align="center"><span class="STYLE2">送货地址确认</span></div></td>
  </tr>
  <tr>
    <td bgcolor="#FF9999" class="STYLE2"><div align="center">省份:
          <select name="select"id="select">
            <option>北京市</option>
            <option>山东省</option>
            <option>河北省</option>
          </select>
    </div></td>
  </tr>
  <tr>
    <td bgcolor="#FF9999" class="STYLE2"><div align="center">城市:
        <select name="select2" id="select2"size="1">
          <option>北京市</option>
          <option>济南市</option>
          <option>石家庄市</option>
        </select>
    </div></td>
  </tr>
  <tr>
    <td bgcolor="#FF9999" class="STYLE2"><div align="center">区:
        <select name="select3" id="select3"size="1">
          <option>西城区</option>
          <option>高新区</option>
          <option>历城区</option>
        </select>
    </div></td>
  </tr>
  </form>
</table>
写这么多其实很简单,就是想问一下怎样取出列表项中的值,这是弹出的一个页面,我想将列表子项值提取出来显示在主页面的文本框中,来点代码吧,好理解
搜索更多相关主题的帖子: div 河北省 北京市 山东省 
2011-09-14 17:19
xmlz
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:5
帖 子:294
专家分:1392
注 册:2010-8-29
收藏
得分:0 
你这个是取不到值的,改option改一下
   <select name="select"id="select">
            <option value="北京市">北京市</option>
            <option value="山东省">山东省</option>
            <option value="河北省">河北省</option>
</select>
2011-09-15 10:33
baojin
Rank: 2
等 级:论坛游民
帖 子:28
专家分:73
注 册:2009-10-12
收藏
得分:0 
index.jsp

<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'index.jsp' starting page</title>
   
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

  </head>
 
  <body>
    <%
        request.setCharacterEncoding("gbk");
        String s1 = request.getParameter("select1");
        String s2 = request.getParameter("select2");
        String s3 = request.getParameter("select3");
        out.println(s1+","+s2+","+s3);
     %>
  </body>
</html>



test.jsp

<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'test.jsp' starting page</title>
   
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

  </head>
 
  <body>
  <form action="./index.jsp" method="post">
   <table  align="center"width="392" height="230" border="0" cellpadding="0" cellspacing="0">
   
      <tr>
    <td bgcolor="#FF9999"><div align="center"><span class="STYLE2">送货地址确认</span></div></td>
      </tr>
      <tr>
        <td bgcolor="#FF9999" class="STYLE2"><div align="center">省份:
          <select name="select1" id="select">
            <option>北京市</option>
            <option>山东省</option>
            <option>河北省</option>
          </select>
        </div></td>
      </tr>
      <tr>
    <td bgcolor="#FF9999" class="STYLE2"><div align="center">城市:
        <select name="select2" id="select2"size="1">
          <option>北京市</option>
          <option>济南市</option>
          <option>石家庄市</option>
        </select>
    </div></td>
  </tr>
  <tr>
    <td bgcolor="#FF9999" class="STYLE2"><div align="center">区:
        <select name="select3" id="select3"size="1">
          <option>西城区</option>
          <option>高新区</option>
          <option>历城区</option>
        </select>
    </div></td>
  </tr>
 

</table>
 <div align="center"><input type="submit" value="确认"/></div>
  </form>
  </body>
</html>

效果展示:
test.jsp
图片附件: 游客没有浏览图片的权限,请 登录注册


index.jsp


界面我就没做了,我就按群主的意思显示在主页上,美观上不用纠结。。。
2011-09-22 15:06
baojin
Rank: 2
等 级:论坛游民
帖 子:28
专家分:73
注 册:2009-10-12
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册
这是test界面。。上面那个是index界面
2011-09-22 15:08
快速回复:【小问题求解】
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015544 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved