Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How to learn javascript quickly


May 29, 2021 Article blog


Table of contents


The importance of JavaScript speaks for itself, and how to learn JavaScript quickly is important.

JavaScript: Event response

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>w3cschool(编程狮)</title> 
</head>
<body>
	
<h1>我的第一个 JavaScript</h1>
<p>
JavaScript 能够对事件作出反应。比如对按钮的点击:
</p>
<button type="button" onclick="alert('欢迎!')">点我!</button>
	
</body>
</html>

JavaScript: Change HTML content

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>w3cschool(编程狮)</title> 
</head>
<body>
	
<h1>我的第一个 JavaScript</h1>
<p>
JavaScript 能够对事件作出反应。比如对按钮的点击:
</p>
<button type="button" onclick="alert('欢迎!')">点我!</button>
	
</body>
</html>

JavaScript: Change the HTML style

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>w3cschool(编程狮)</title> 
</head>
<body>
<h1>我的第一段 JavaScript</h1>
<p id="demo">
JavaScript 能改变 HTML 元素的样式。
</p>
<script>
function myFunction()
{
	x=document.getElementById("demo") // 找到元素
	x.style.color="#ff0000";          // 改变样式
}
</script>
<button type="button" onclick="myFunction()">点击这里</button>
</body>
</html>

JavaScript displays the data

  • Use console .log() to write to the browser's console display
  • Use window.alert() to pop up a warning box
  • Write HTML elements using innerHTML
  • Write to HTML using the document.write() method

JavaScript letter case

JavaScript is sensitive to case, so be aware that case toggles are accurate, such as: getElementById and getElementbyId are different.

Here's what the editor-in-chief brings you about how to learn javascript quickly