当前位置:网站首页>Create cells through JS (while loop)
Create cells through JS (while loop)
2022-04-23 05:26:00 【Courtesy.】
<script>
function table(options = {
tr: 5, td: 3 }) {
// Create a function , And pass him a parameter options, Set the default initial value
document.write(`<table border="1" width="100%>`);
while (options.tr-- !== 0){
let td = options.td; // Let the cells in each row be the default number of cells and columns
document.write(`<tr>`);
while (options.tr-- !== 0){
document.write(`<td>${
td}</td>`);
}
document.write(`<td>`);
}
document.write(`<table>`);
}
table(); // Call this function You can see the results
//table({ tr: 20, td: 10 }); You can customize the number of rows and columns
</script>
版权声明
本文为[Courtesy.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220544339213.html
边栏推荐
- Error handling mechanism of the strongest egg framework in history
- Open source rule engine - Ice: dedicated to solving flexible and complex hard coding problems
- Ehcache Memcache redis three caches
- How to realize adaptive layout
- Solve the problem of JS calculation accuracy
- SQL Server检索SQL和用户信息的需求
- Box collapse and margin collapse
- Implementation of resnet-34 CNN with kears
- 2021-09-23
- 开源规则引擎——ice:致力于解决灵活繁复的硬编码问题
猜你喜欢
随机推荐
Requirements for SQL server to retrieve SQL and user information
Study notes: unity customsrp-13-colorgrading
Laravel [view]
2021-09-27
Redis的基本知识
Mariadb的半同步复制
Wbpack configuring production development environment
Data management of basic operation of mairadb database
(十一)vscode代码格式化配置
What role do tools play in digital transformation?
String class understanding - final is immutable
mariadb数据库的主从复制
点击添加按钮--出现一个框框(类似于添加学习经历-本科-研究生)
Blender程序化地形制作
MFC implementation resources are implemented separately by DLL
Basic knowledge of redis
varnish入门
What are the most popular recruitment technical skills in 2022? You can't think of it
学习笔记:Unity CustomSRP-13-ColorGrading
What are the reasons for the failure of digital transformation?