MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » JSP 全选有关问题

JSP 全选有关问题

www.MyException.Cn  网友分享于:2013-02-02  浏览:17次
JSP 全选问题

做一个邮件系统的时候,我想实现当点击全选的时候,把所有选中的Email都显示在一个文本框中,Email地址是循环读取出来的,,但读取的时候,只读取到第一个Email地址..

哪位大虾帮帮忙......急!

JS页面代码


function SetChecked(boxname,phone){
  f=document.form1;
  for( i=0 ; i<f.elements.length ; i++){
  if (f.elements[i].name==boxname) {
f.elements[i].checked=true;
for(j = 0; j<f.elements[i]..length;j++){

var send = document.getElementById("phone1").value;
document.getElementById("phone1").value = document.getElementById("phone1").value + phone + ";";
}
}
  }
  }
  }
  




JSP 页面代码


<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ page import = "com.jytg.dao.imp.*, com.jytg.model.*" %>
<%
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 'Message.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">
-->
<style>
.a{
border:none;
cursor:pointer;
}
</style>
  </head>
  
  <script>
  function SetChecked(boxname,phone){
  f=document.form1;
  for( i=0 ; i<f.elements.length ; i++){
  if (f.elements[i].name==boxname) {
f.elements[i].checked=true;
for(j = 0; j<f.elements[i]..length;j++){

var send = document.getElementById("phone1").value;
document.getElementById("phone1").value = document.getElementById("phone1").value + phone + ";";
}
}
  }
  }
  }
  
  function addPhone(phone){
  var send = document.getElementById("phone1").value;
document.getElementById("phone1").value = document.getElementById("phone1").value + phone + ";";
  }
  </script>
  <body>
<form id="form1" name="form1" method="post" action="<%=basePath %>servlet/SendMessage">
<table width="902" height="330" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="32" colspan="5" align="center">短信息发送</td>
</tr>
<tr>
<td width="100" align="center">收件人:</td>
<td colspan="2" align="center">
<textarea name="phone1" id = "phone1" cols="78" rows = "20"></textarea>
</td>

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有