<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP ‘index.jsp‘ starting page</title>
<script type="text/javascript">
function method(id) {
alert(id);
}
</script>
</head>
<body>
<%
for(int i = 0;i<2 ;i++){
%>
<input type="button" id="<%=i%>" onclick="method(‘<%=i%>‘);" value="添加">
<%}%>
</body>
</html>
时间: 2024-10-29 19:10:03