展开全部
用JS生成:
<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function toTable(){
var rows = document.getElementById("txtRow").value;
var cols = document.getElementById("txtCol").value;
var textHTML = '<table cellpadding="0" cellspacing="0" border="1" width="100%">';
for(var i=0; i<rows; i++){
textHTML += '<tr align="center" height="30">';
for(var j=0; j<cols; j++){
textHTML += "<td>[" + (i+1) + "] | [" + (j+1) + "]</td>";
}
}
textHTML += "</table>";
document.getElementById("testTable").innerHTML = textHTML;
}
</script>
</head>
<body onload="toTable();">
行:<input type="text" name="txtRow" value="3" style="width: 50px;"/>
列:<input type="text" name="txtCol" value="3" style="width: 50px;"/>
<input type="button" name="btnGo" value="生成" onclick="toTable();"/>
<br />
<div id="testTable">
</div>
</body>
</html>
----------------------------------------------------------
用JAVA代码:
<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
<title>Test</title>
</head>
<body>
<div>
<table cellpadding="0" cellspacing="0" border="1" width="100%">
<%
int rows = 3; // 多少行
int cols = 3; // 多少列
for(int i = 0; i < rows; i++ ){
%>
<tr align="center" height="30">
<%
for(int j = 0; j < cols; j++ ){
%>
<td>[<%=i+1 %>] | [<%=j+1 %>]</td>
<%
}
}
%>
</table>
</div>
</body>
</html>
<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function toTable(){
var rows = document.getElementById("txtRow").value;
var cols = document.getElementById("txtCol").value;
var textHTML = '<table cellpadding="0" cellspacing="0" border="1" width="100%">';
for(var i=0; i<rows; i++){
textHTML += '<tr align="center" height="30">';
for(var j=0; j<cols; j++){
textHTML += "<td>[" + (i+1) + "] | [" + (j+1) + "]</td>";
}
}
textHTML += "</table>";
document.getElementById("testTable").innerHTML = textHTML;
}
</script>
</head>
<body onload="toTable();">
行:<input type="text" name="txtRow" value="3" style="width: 50px;"/>
列:<input type="text" name="txtCol" value="3" style="width: 50px;"/>
<input type="button" name="btnGo" value="生成" onclick="toTable();"/>
<br />
<div id="testTable">
</div>
</body>
</html>
----------------------------------------------------------
用JAVA代码:
<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
<title>Test</title>
</head>
<body>
<div>
<table cellpadding="0" cellspacing="0" border="1" width="100%">
<%
int rows = 3; // 多少行
int cols = 3; // 多少列
for(int i = 0; i < rows; i++ ){
%>
<tr align="center" height="30">
<%
for(int j = 0; j < cols; j++ ){
%>
<td>[<%=i+1 %>] | [<%=j+1 %>]</td>
<%
}
}
%>
</table>
</div>
</body>
</html>
博思aippt
2024-07-20 广告
2024-07-20 广告
作为深圳市博思云创科技有限公司的工作人员,对于Word文档生成PPT的操作,我们有以下建议:1. 使用另存为功能:在Word中编辑完文档后,点击文件->另存为,选择PowerPoint演示文稿(*.pptx)格式,即可将文档内容转换为PPT...
点击进入详情页
本回答由博思aippt提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询