JavaScript implements the output of a rectangular code with 5 rows and 6 columns using js external links

   The following is the program code and running screenshots to output a rectangle with 5 rows and 6 columns by using the js external link

Table of contents

foreword

1. Use the js external link to output a rectangle with 5 rows and 6 columns (HTML part)

1.1 Operation process and ideas

1.2 Code snippet

1.3 JavaScript statement code

2. Use the js external link to output a rectangle with 5 rows and 6 columns (js part)

1.1 Operation process and ideas

1.2 Code snippet

3. JavaScript part (full version)

1.2 Code snippet


foreword

1. If you have a choice, you can quickly search in the directory;

2. The code of this blog post can realize relevant functions according to the requirements of the topic. At the same time, custom settings can be realized;

3. This article introduces JavaScript code exercises. The software used in this blog post is the code written by HBuilder X3.7.9. In principle, other software such as DW, VSCode or DW lower or higher versions are compatible. If you have In principle, it is possible to run normally if the software is required and the written software is not HBX;

Figure 1 Example of writing software (partial)

4. Here is a special explanation, because I use HBX, so it is in the web format, I also pasted the <script> statement separately, if necessary, you can directly copy the <script></script> statement;

5. The code of this blog post was written by me when I was in school. There are some places that have not been perfectly implemented. Please forgive me and give me more advice. If you find any problems, please feedback them to me so that I can correct the mistakes and summarize and improve them. , Continuous improvement! 

6. Blog posts usually need to be run in a browser, usually a form will pop up, enter a value and get the result. This article uses Google Chrome, and Google Chrome is recommended;

7. If infringement is involved, please contact to delete;


提示:以下是本篇文章正文内容,下面案例可供参考

1. Use the js external link to output a rectangle with 5 rows and 6 columns (HTML part)

1.1 Operation process and ideas

This is the code to define the output rectangle with 5 rows and 6 columns through the external link. The specific thought process is as follows:

1.2 Code snippet

The code is as follows (example):

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="4.js">
			
		</script>
	</head>
	<body>
	</body>
</html>

1.3 JavaScript statement code

The code is as follows (example):

<script src="4.js">
			
		</script>

2. Use the js external link to output a rectangle with 5 rows and 6 columns (js part)

1.1 Operation process and ideas

(I named the js part file after 4.js)

1.2 Code snippet

The code is as follows (example):

var arr = new Array(new Array("*","*","*","*","*"),new Array("*","*","*","*","*"),new Array("*","*","*","*","*"),new Array("*","*","*","*","*"),new Array("*","*","*","*","*"),new Array("*","*","*","*","*"));
			for( var i in arr)
			{
				for(var j in arr[i])
				{document.write("&nbsp;")
					document.write(arr[i][j])+"";
				}
				
				document.write("<br>");
				
			}		

3. JavaScript part (full version)

1.2 Code snippet

The code is as follows (example):

<script type="text/javascript">
	var arr = new Array(new Array("*","*","*","*","*"),new Array("*","*","*","*","*"),new Array("*","*","*","*","*"),new Array("*","*","*","*","*"),new Array("*","*","*","*","*"),new Array("*","*","*","*","*"));
			for( var i in arr)
			{
				for(var j in arr[i])
				{document.write("&nbsp;")
					document.write(arr[i][j])+"";
				}
				
				document.write("<br>");
				
			}		
		</script>

The running results are as follows (example):

1.4.1 Browser pop-up form display results

Guess you like

Origin blog.csdn.net/weixin_59042297/article/details/130899514