双击可编辑

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	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>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>双击可编辑</title>
		<script type="text/javascript">
		   function edit(){
		    document.getElementById("salary").innerHTML="<input type='text' name='sa' value='3000'/>";
		    document.getElementById("workAge").innerHTML="<input name='wa' value='2'/>";
		    document.getElementById("age").innerHTML="<input name='a' value='22'/>";
		    document.getElementById("operator").innerHTML="<input type='button' name='m' value='确定'/><input type='button' name='n' value='取消'/>";
		   }
		</script>
	</head>
    <body>
      <table>
         <tr>
            <th>工资</th><th>工龄</th><th>年龄</th><th>操作</th>
         </tr>
         <tr>
           <td id="salary">3000</td><td id="workAge">2</td><td id="age">22</td><td onclick="edit()" id="operator"><a>编辑</a></td>
         </tr>
      </table>
    </body>		
</html>

 

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