What are the commonly used attribute methods in JavaScript?
Commonly used attribute methods in JavaScript include: 1. The comment in JS is [//]; 2. Convert character type to numeric type [parseInt()]; 3. Get the length of the string [length]; 4. Use var to declare variables; 5. Judgment statement structure [if(condition){}else{}].
The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, DELL G3 computer.
Commonly used attribute methods in JavaScript are:
1.document.write(""); Output statement
2. The comment in JS is/ /
3. The traditional HTML document sequence is: document->;html->(head,body)
4. The DOM sequence in a browser window is: window ->;(navigator,screen,history,location,document)
5. Get the name and value of the element in the form: document.getElementById("ID number of the element in the form").name (or value )
6. A lowercase to uppercase JS:
document.getElementById("output").value=document.getElementById("input").value.toUpperCase();
7. Value types in JS: String, Number, Boolean, Null, Object, Function
8. Convert character types into numerical types in JS: parseInt(), parseFloat()
9. Convert numbers in JS to character type: ("" variable)
10. Get the string length in JS: (length)
11.JS Characters are connected with characters using numbers.
12. The comparison operators in JS are: ==Equal,!=Not equal,>;,>;=,<.<=
13. Use var to declare variables in JS.
14. Judgment statement structure in JS: if(condition){}else{}
15.JS The loop structure in: for([initial expression];[condition];[upadte expression]) {inside loop}
16. The command to terminate the loop is: break
17. In JS Function definition: function functionName([parameter],...){statement[s]}
18. When multiple form forms appear in the file, you can use document.forms[0],document. forms[1] instead.
19. Window: Open the window window.open(), close a window: window.close(), the window itself: self
20. Status bar Setting: window.status="Character";
21. Pop-up prompt message: window.alert("Character");
22. Pop-up confirmation box: window.confirm();
23. Pop up the input prompt box: window.prompt();
24. Specify the location of the currently displayed link: window.location.href="URL"
25. Get the number of all forms in the form: document.forms.length
26. Close the output stream of the document: document.close();
27. String append connector: =
28. Create a document element: document.createElement(),document.createTextNode()
29. Get the element method: document.getElementById()
30. Set the value of all text members in the form to empty:
var form = window.document.forms[0] for (var i = 0; i<form.elements.length;i ){ if (form.elements.type == "text"){ form.elements.value = ""; } }
31. Determine whether the check button is checked in JS:
document.forms[0].checkThis.checked
(The checked attribute represents whether it is selected and returns TRUE or FALSE )
32. Radio button group (the names of the radio buttons must be the same):
Get the length of the radio button group document.forms[0].groupName.length
33. Checked is also used to determine whether the radio button group is selected.
34. The value of the drop-down list box:
document.forms[0].selectName.options[n].value
(nSometimes the name of the drop-down list box plus .selectedIndex is used to determine Determine the selected value)
35. Definition of string: var myString = new String("This is lightsword");
36. Convert string to uppercase: string.toUpperCase( ); Convert the string to lowercase: string.toLowerCase();
37. Return the position where string 2 appears in string 1: String1.indexOf("String2")!=-1 means there is no Find.
38. Get a character at the specified position in the string: StringA.charAt(9);
39. Get the substring with the specified starting point and end point in the string: stringA. substring(2,6);
40. Math functions:
Math.PI (returns pi), Math.SQRT2 (returns square root), Math.max(value1, value2) returns The
of the two numbers is the most valuable, Math.pow(value1,10) returns the tenth power of value1, Math.round(value1) rounding function,
Math.floor(Math .random()*(n 1)) returns a random number
41. Define date variable: var today = new Date();
42. Date function list:
dateObj.getTime() gets the time, dateObj.getYear() gets the year, dateObj.getFullYear() gets the four-digit year,
dateObj.getMonth () gets the month, dateObj.getDate() gets the day, dateObj.getDay() gets the date,
dateObj.getHours() gets the hours, dateObj.getMinutes() gets the minutes, dateObj.getSeconds() gets seconds,
dateObj.setTime(value)设置时间,dateObj.setYear(val)设置年,
dateObj.setMonth(val)设置月,dateObj.setDate(val)设置日,
dateObj.setDay(val)设置星期几,dateObj.setHours设置小时,dateObj.setMinutes(val)设置分,
dateObj.setSeconds(val)设置秒 [注意:此日期时间从0开始计]
43.FRAME的表示方式:
[window.]frames[n].ObjFuncVarName,frames["frameName"].ObjFuncVarName,frameName.ObjFuncVarName
44.parent代表父亲对象,top代表最顶端对象
45.打开子窗口的父窗口为:opener
46.表示当前所属的位置:this
47.当在超链接中调用JS函数时用:(javascript :)来开头后面加函数名
48.在老的浏览器中不执行此JS:;
49.引用一个文件式的JS:;
50.指定在不支持脚本的浏览器显示的HTML:

How to use WebSocket and JavaScript to implement an online speech recognition system Introduction: With the continuous development of technology, speech recognition technology has become an important part of the field of artificial intelligence. The online speech recognition system based on WebSocket and JavaScript has the characteristics of low latency, real-time and cross-platform, and has become a widely used solution. This article will introduce how to use WebSocket and JavaScript to implement an online speech recognition system.

WebSocket and JavaScript: Key technologies for realizing real-time monitoring systems Introduction: With the rapid development of Internet technology, real-time monitoring systems have been widely used in various fields. One of the key technologies to achieve real-time monitoring is the combination of WebSocket and JavaScript. This article will introduce the application of WebSocket and JavaScript in real-time monitoring systems, give code examples, and explain their implementation principles in detail. 1. WebSocket technology

Introduction to how to use JavaScript and WebSocket to implement a real-time online ordering system: With the popularity of the Internet and the advancement of technology, more and more restaurants have begun to provide online ordering services. In order to implement a real-time online ordering system, we can use JavaScript and WebSocket technology. WebSocket is a full-duplex communication protocol based on the TCP protocol, which can realize real-time two-way communication between the client and the server. In the real-time online ordering system, when the user selects dishes and places an order

How to use WebSocket and JavaScript to implement an online reservation system. In today's digital era, more and more businesses and services need to provide online reservation functions. It is crucial to implement an efficient and real-time online reservation system. This article will introduce how to use WebSocket and JavaScript to implement an online reservation system, and provide specific code examples. 1. What is WebSocket? WebSocket is a full-duplex method on a single TCP connection.

JavaScript and WebSocket: Building an efficient real-time weather forecast system Introduction: Today, the accuracy of weather forecasts is of great significance to daily life and decision-making. As technology develops, we can provide more accurate and reliable weather forecasts by obtaining weather data in real time. In this article, we will learn how to use JavaScript and WebSocket technology to build an efficient real-time weather forecast system. This article will demonstrate the implementation process through specific code examples. We

JavaScript tutorial: How to get HTTP status code, specific code examples are required. Preface: In web development, data interaction with the server is often involved. When communicating with the server, we often need to obtain the returned HTTP status code to determine whether the operation is successful, and perform corresponding processing based on different status codes. This article will teach you how to use JavaScript to obtain HTTP status codes and provide some practical code examples. Using XMLHttpRequest

Usage: In JavaScript, the insertBefore() method is used to insert a new node in the DOM tree. This method requires two parameters: the new node to be inserted and the reference node (that is, the node where the new node will be inserted).

JavaScript is a programming language widely used in web development, while WebSocket is a network protocol used for real-time communication. Combining the powerful functions of the two, we can create an efficient real-time image processing system. This article will introduce how to implement this system using JavaScript and WebSocket, and provide specific code examples. First, we need to clarify the requirements and goals of the real-time image processing system. Suppose we have a camera device that can collect real-time image data
