实现鼠标单击获得table一行的分别值

这篇文章为网络转载,作为平时笔记,红色部分是我用到的
<%--
/**
* SSZUTC Shenyi 20Jan2005 replaced previous log mode with SSCLogger
*/
--%>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="portlet" %>


<%@ page language="java" contentType="text/html; charset=ISO-8859-1" %>


<%@ page import="java.util.*" %>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">


<script language="javascript">

var currentActiveRow;
function   changeActiveRow(obj)  
  {  
  if(currentActiveRow)   currentActiveRow.style.backgroundColor="";  
  currentActiveRow=obj;  
  currentActiveRow.style.backgroundColor="gray";
  //var temp=currentActiveRow[0].innerText;
  var roleName=currentActiveRow.cells[0].innerText;
  var roleType=currentActiveRow.cells[1].innerText;
  var description=currentActiveRow.cells[2].innerText;
  alert(" message:"+ roleName+ " "+ roleType+" "+description);
  //alert("message:"+temp);
  }

function submitAction(action)
{
// alert("action clicked:"+action);
var submitForm = "";
//submitForm.submit();
if( action == 'create')
{
  createReportGroupForm = window.document.forms['<portlet:encodeNamespace value=""></portlet:encodeNamespace>CreateReportGroupForm'];     
 
//  alert("action set to:"+ createReportGroupForm.action);

  createReportGroupForm.reportSourceID.value = this.reportSourceID.value; 
  createReportGroupForm.reportSourceName.value = this.reportSourceName.value;
  createReportGroupForm.applicationID.value = this.applicationID.value;      
  createReportGroupForm.applicationName.value = this.applicationName.value;        

//  alert ("app + this.applicationName.value);   
 
  createReportGroupForm.submit();
}
else if( action == 'modify')
{
  modifyReportGroupForm = window.document.forms['<portlet:encodeNamespace value=""></portlet:encodeNamespace>ModifyReportGroupForm'];     

  if (this.AvailableReportGroups.selectedIndex == -1) {
   alert ("Please select a report group ");
   return;
  }
 
//  alert("action set to:"+ modifyReportGroupForm.action);

  modifyReportGroupForm.reportSourceID.value = this.reportSourceID.value; 
  modifyReportGroupForm.reportSourceName.value = this.reportSourceName.value;
  modifyReportGroupForm.applicationID.value = this.applicationID.value;      
  modifyReportGroupForm.applicationName.value = this.applicationName.value;        

  modifyReportGroupForm.reportGroupName.value = this.AvailableReportGroups.options[this.AvailableReportGroups.selectedIndex].text;
  modifyReportGroupForm.reportGroupName.value = this.AvailableReportGroups.options[this.AvailableReportGroups.selectedIndex].title;
  modifyReportGroupForm.reportGroupID.value = this.AvailableReportGroups.options[this.AvailableReportGroups.selectedIndex].value; 

//  alert ("group + modifyReportGroupForm.reportGroupName.value); 
//  alert ("app + this.applicationName.value);   
 
//  alert ("title = " + this.AvailableReportGroups.options[this.AvailableReportGroups.selectedIndex].title);
 
  modifyReportGroupForm.submit();
}
else if( action == 'delete')
{
  deleteReportGroupForm = window.document.forms['<portlet:encodeNamespace value=""></portlet:encodeNamespace>DeleteReportGroupForm'];     

  if (this.AvailableReportGroups.selectedIndex == -1) {
   alert ("Please select a report group ");
   return;
  }
 
  var Input;
  Input = confirm("Are you sure to delete the selected report group?")
  if(Input == false){
   return;
  }
 
  deleteReportGroupForm.reportSourceID.value = this.reportSourceID.value;
  deleteReportGroupForm.applicationID.value = this.applicationID.value;
  deleteReportGroupForm.applicationName.value = this.applicationName.value;        
  deleteReportGroupForm.reportSourceName.value = this.reportSourceName.value; 
  deleteReportGroupForm.reportGroupID.value = this.AvailableReportGroups.options[this.AvailableReportGroups.selectedIndex].value;
  deleteReportGroupForm.reportGroupName.value = this.AvailableReportGroups.options[this.AvailableReportGroups.selectedIndex].text; 
  deleteReportGroupForm.reportGroupName.value = this.AvailableReportGroups.options[this.AvailableReportGroups.selectedIndex].title; 
//  alert("action set to:"+ deleteReportGroupForm.action);
 
//  alert ("app + deleteReportGroupForm.applicationID.value);
//  alert ("report group + deleteReportGroupForm.reportGroupID.value); 
 
  deleteReportGroupForm.submit();
} else if ( action == 'cancel') {

  cancelForm = window.document.forms['<portlet:encodeNamespace value=""></portlet:encodeNamespace>ReportGroupAppSourceForm'];     
 
//  alert("action set to:"+ cancelForm.action);

  cancelForm.submit();

}
}
function validate()
{
return  true;
}

function func_1(thisObj, thisEvent) {
//use 'thisObj' to refer directly to this component instead of keyword 'this'
//use 'thisEvent' to refer to the event generated instead of keyword 'event'
cl;
}</script>



<jsp:useBean scope="request" /> 


<%




String fromMyViewJSP = request.getParameter("fromMyViewJSP");
// if (fromMyViewJSP == null) {

%>



<title>ReportGroupAdmin</title>



<table width="100%" border="1" cellspacing="0" cellpadding="0" height="100%">
   <tr>
  <td width="100%" valign="top">
        <table width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
          <tr>
             <td >Report Groups</td>
          </tr>
          <tr>
             <td valign="top" height="53">
               <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td valign="top" width="3%"><img src='<%= response.encodeURL("/images/info.gif") %>' width="18" height="15"></td>
                    <td valign="top" width="97%">Select
                       a report group from the list box before selecting an action
                       button (Create New Group, Modify Selected, Delete Selected).
                      </td>
                  </tr>
               </table>
               <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr>
                    <td height="30"><br>
                       <a href=" ('cancel')">&lt;&lt; Report Group App Source </a> | Report
                       Group Admin
                      </td>
                  </tr>
               </table>
        </td>
          </tr>
         
          <tr>
             <td height="26">
               <table width="100%" RULES="none"  FRAME="box" border="1" bordercolor="#eaeaea" cellspacing="0" cellpadding="2">
                  <tr height="18">
                    <td width="46%" >&nbsp;</td>
                    <td width="54%" >&nbsp;</td>
                  </tr>
         <tr>
          <td ></td>
          <td >&nbsp;</td>
         </tr>
      </table>
               <br>
               <table width="100%" rules="none" frame="box" bordercolor="#eaeaea" border="1" cellspacing="0" cellpadding="0">
                  <tr height="18">
                    <td >&nbsp;Existing Report Groups</td>
                 </tr>
                  <tr>
                    <td>
                       <table width="100%" border="0" cellspacing="0" cellpadding="1">
                         <tr height="30">
                            <td width="25%" valign="middle">
               <input type="button" value="Create New Role"   create')"  >
                            </td>
                            <td width="25%" valign="middle">
                              <input type="button" value="Modify Selected"
            modify')"  >
                            </td>
                            <td width="25%" valign="middle">
                              <div align="left">
                                 <input type="button" value="Delete Selected" delete')"  >
                              </div>
                            </td>
                           
                            <td width="21%" valign="top">&nbsp; </td>
                         </tr>
                       </table>
                    </td>
                  </tr>
               </table>
               <table width="100%" border="1" cellspacing="0" cellpadding="2" height="55" bordercolor="#eaeaea">
                  <tr>
                    <td height="20" valign="top">
     
         <TABLE width="100%" height="20" border="1">
          <tr>
           <th>Role Name</th>
           <th>Role Type</th>
           <TH>Description</TH>
          </tr>      
         </TABLE>
        </td>
       </tr>
       <tr>
        <td height="230">
      <div style="width=100%; height:230; overflow:auto">
      <table width="100%">
       <tr ><th>wwwa</th><th>wwwq</th><th>wwwe</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
       <tr ><th>www</th><th>www</th><th>www</th></tr>
      </table>
      </div>
     
     
      </td>
                  </tr>
               </table>
               <p>&nbsp;</p>
             </td>
          </tr>
        </table>
     </td>
   </tr>
</table>

你可能感兴趣的:(html,Web,bean,struts)