


js dynamically generates a table with a specified number of rows_javascript skills
The following js implementation can be used to generate a table with the number of rows required by the user.
1. First fill in the following code in the body to get the row value filled in by the user
Dynamicly generate table | row |
< /br>
The effect is as shown below:

2.Add js code in header
<script> <br>function table() { <br>if (document.getElementById("Num").value == "" || document.getElementById("Num").value.search("^[0-9]* $") == -1) { <br>document.getElementById("errmsg1").style.display = "block";//Judge whether Num is empty or not a number and prompt an error <br>document.getElementById("errmsg1 ").innerHTML = "Prompt message: The row number is empty or not a number! "; <br>} <br>else { <br>document.getElementById("errmsg1").style.display = "none";// Hide prompt information<br>var Num = parseInt(document.getElementById("Num").value); //Get the number of rows<br>var flag = true; <br>var data = ""; <br>data = " <table >"; <br>data = " <tr>" <br>"<td >we are</td>" <br>"<td >zhuzhu</td>" <br>"<td >dudu</td>" <br>"</tr>" ; <br>for (var i = 1; i <= Num; i ) { <BR>data = "<tr >"; <br>data = "<td>" i "</td>"; <br>data = "<td><input name='ColdDay" i "' type ='text' class='input'></td>"; <br>data = "<td><input name='ColdCureMethod" i "' type='text' class='input'> ;</td>"; <br>data = "</tr>"; <br>} <br>data = "</table>"; <br>document.getElementById("div1"). style.display = "block"; <br>document.getElementById("table1").innerHTML = data; <br>} <br>} <br></script>
generated The effect is as follows:

3. All codes are as follows:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() "://" request.getServerName() ":" request.getServerPort() path "/";
%>
<script> <br>function table() { <br>if (document.getElementById("Num").value == "" || document.getElementById("Num").value.search("^[0-9]*$") == -1) { <br>document.getElementById("errmsg1").style.display = "block";//判断payNum是否为空或不是数字 提示错误 <br>document.getElementById("errmsg1").innerHTML = "提示信息:行数为空或不是数字!"; <br>} <br>else { <br>document.getElementById("errmsg1").style.display = "none";//隐藏提示信息 <br>var Num = parseInt(document.getElementById("Num").value); //获取分期数 <br>var flag = true; <br>var data = ""; <br>data = " <table >"; <br>data = " <tr>" <br>"<td >we are</td>" <br>"<td >zhuzhu</td>" <br>"<td >dudu</td>" <br>"</tr>" ; <br>for (var i = 1; i <= Num; i ) { <BR>data = "<tr >"; <br>data = "<td>" i "</td>"; <br>data = "<td><input name='ColdDay" i "' type='text' class='input'></td>"; <br>data = "<td><input name='ColdCureMethod" i "' type='text' class='input'></td>"; <br>data = "</tr>"; <br>} <br>data = "</table>"; <br>document.getElementById("div1").style.display = "block"; <br>document.getElementById("table1").innerHTML = data; <br>} <br>} <br></script>
动态生成表格 | 行 |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



1. Create a new PPT file and name it [PPT Tips] as an example. 2. Double-click [PPT Tips] to open the PPT file. 3. Insert a table with two rows and two columns as an example. 4. Double-click on the border of the table, and the [Design] option will appear on the upper toolbar. 5. Click the [Shading] option and click [Picture]. 6. Click [Picture] to pop up the fill options dialog box with the picture as the background. 7. Find the tray you want to insert in the directory and click OK to insert the picture. 8. Right-click on the table box to bring up the settings dialog box. 9. Click [Format Cells] and check [Tile images as shading]. 10. Set [Center], [Mirror] and other functions you need, and click OK. Note: The default is for pictures to be filled in the table

Being able to skillfully make forms is not only a necessary skill for accounting, human resources, and finance. For many sales staff, learning to make forms is also very important. Because the data related to sales is very large and complex, and it cannot be simply recorded in a document to explain the problem. In order to enable more sales staff to be proficient in using Excel to make tables, the editor will introduce the table making issues about sales forecasting. Friends in need should not miss it! 1. Open [Sales Forecast and Target Setting], xlsm, to analyze the data stored in each table. 2. Create a new [Blank Worksheet], select [Cell], and enter [Label Information]. [Drag] downward and [Fill] the month. Enter [Other] data and click [

1. Open the worksheet and find the [Start]-[Conditional Formatting] button. 2. Click Column Selection and select the column to which conditional formatting will be added. 3. Click the [Conditional Formatting] button to bring up the option menu. 4. Select [Highlight conditional rules]-[Between]. 5. Fill in the rules: 20, 24, dark green text with dark fill color. 6. After confirmation, the data in the selected column will be colored with corresponding numbers, text, and cell boxes according to the settings. 7. Conditional rules without conflicts can be added repeatedly, but for conflicting rules WPS will replace the previously established conditional rules with the last added rule. 8. Repeatedly add the cell columns after [Between] rules 20-24 and [Less than] 20. 9. If you need to change the rules, you can just clear the rules and then reset the rules.

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

Sometimes, we often encounter counting problems in Word tables. Generally, when encountering such problems, most students will copy the Word table to Excel for calculation; some students will silently pick up the calculator. Calculate. Is there a quick way to calculate it? Of course there is, in fact the sum can also be calculated in Word. So, do you know how to do it? Today, let’s take a look together! Without further ado, friends in need should quickly collect it! Step details: 1. First, we open the Word software on the computer and open the document that needs to be processed. (As shown in the picture) 2. Next, we position the cursor on the cell where the summed value is located (as shown in the picture); then, we click [Menu Bar

Essential tools for stock analysis: Learn the steps to draw candle charts in PHP and JS. Specific code examples are required. With the rapid development of the Internet and technology, stock trading has become one of the important ways for many investors. Stock analysis is an important part of investor decision-making, and candle charts are widely used in technical analysis. Learning how to draw candle charts using PHP and JS will provide investors with more intuitive information to help them make better decisions. A candlestick chart is a technical chart that displays stock prices in the form of candlesticks. It shows the stock price

How to use PHP and JS to create a stock candle chart. A stock candle chart is a common technical analysis graphic in the stock market. It helps investors understand stocks more intuitively by drawing data such as the opening price, closing price, highest price and lowest price of the stock. price fluctuations. This article will teach you how to create stock candle charts using PHP and JS, with specific code examples. 1. Preparation Before starting, we need to prepare the following environment: 1. A server running PHP 2. A browser that supports HTML5 and Canvas 3

When we make tables, the first thing we think of is to use Excel software to make tables. But did you know that Word software is actually very convenient to make tables. Sometimes when we make tables in Word software, we need to enter serial numbers or numbers. , if you enter them one by one manually, it will be very troublesome. In fact, there is an operation in the word software that can automatically insert numbers or serial numbers. So let’s learn with the editor how to insert automatic numbering or serial numbers into Word tables. . 1. First create a Word document and insert a table. 2. Select the column or cell where you want to insert automatic serial numbers or numbers. 3. Click "Start" - "Number". 4. Select one of the style numbers. 5.
