JS Learning Notes

Source: Internet
Author: User

One

A binary system is a scientific method by which people use symbols to count. For any one of the binary---x-binary, it means that the number operation at a certain position is every X-step.

Decimal is every ten into a, hexadecimal is every 16 into one, binary is every two into one. The number system, also known as the counter, refers to the method of representing numerical values with a set of fixed symbols and uniform rules.

A computer is a tool for information processing, which must be converted into binary form data before it can be processed, stored, and transmitted by a computer.

Two

  Alert is a scripting language used in the HTML DOM, and its Chinese meaning is "reminders". It is a common method for Windows window objects in JavaScript or VBScript scripting languages;

The main usage is that after you define a certain function, the language of the dialog box pops up by performing the corresponding action. And the Alert dialog box is typically used for some user-prompted information.

Three

Document Object
Each HTML document that is loaded into the browser becomes the Document object
The Document object allows us to access all elements of an HTML page from within a script.

Four

The write () method writes an HTML expression or JavaScript code to a document.
Multiple parameters (Exp1,exp2,exp3,...) can be listed, which are appended sequentially to the document.
Grammar
document.write (Exp1,exp2,exp3,....)
Although based on the DOM standard, this method accepts only a single string as a parameter. However, based on experience, write () can accept any number of parameters.
We usually use the write () method in two ways: one is to use that side to output HTML in the document, and the other is to create a new document in a window, frame, outside the window that calls the method.

In the second case, be sure to close the document using the close () method.

Five

The document.write () method can be used in two ways: to create page content in a live script during page loading, and to create the contents of this window or a new window with a deferred script. The method requires a string argument that is written to the HTML content in the window or frame. These string arguments can be variables or expressions with values that are strings, and the content that is written often includes the HTML markup language.
Remember, after loading the page, the browser output stream is automatically closed. After that, any document.write () method that operates on the current page opens-a new output stream that clears the current page content (including any variables or values from the source document). Therefore, if you want to replace the current page with script-generated HTML, you must concatenate the HTML content to assign a variable and use a document.write () method to complete the write operation. You do not have to clear the document and open a new data stream, and a document.write () call will do all of the work.
One more thing to note about the document.write () method is its associated method, Document.close (). The output stream must be closed after the script has finished writing to the window (either this window or another window). After the last document.write () method of the deferred script, you must make sure that the Document.close () method is included, and that the image and form cannot be displayed without doing so. Also, any subsequent call to the document.write () method will simply append the content to the page without erasing the existing content to write the new value. To demonstrate the document.write () method, we provide two versions of the same application. One to write to the document containing the script, and another-to-a separate window to write the content. In the text editor, click each document, save it with an. html file name extension, and open the document in the browser.

Six

Definition and usage
The prompt () method is used to display a dialog box that prompts the user for input.
Grammar
Prompt (Text,defaulttext)
Description
Returns NULL if the user clicks the Cancel button of the prompt box. If the user clicks the Confirm button, the text that is currently displayed in the input field is returned. It will block all user input to the browser until the user clicks the OK button or the Cancel button to close the dialog box. When prompt () is called, execution of the JavaScript code is paused, and the next statement is not executed until the user responds.

Seven 
It's mostly handy for your JavaScript. You can see what you're outputting in the page.
His advantages compared to alert are:
1. He can see the structure of things, if it is alert, fade out an object is [Object Object], but the console can see the contents of the object.
2. Console does not interrupt the operation of your page, if you use alert to bounce out the content, then the page is dead, but the console output after your page can be normal operation.
3. The contents of the console are very rich, you can enter: Console in the console, then you can see:
Console {memory:memoryinfo, debug:function, Error:function, Info:function, log:function ...} It has various tips for Web pages.

Eight

declaring (creating) JavaScript variables creating variables in JavaScript is often referred to as "declaration" variables. You can declare a JavaScript variable by using the var statement: var x; var carname; After the declarations above, the variables do not have values, but you can assign values to variables when declaring them: Var x=5; var carname= "Volvo"; Note: When assigning a text value to a variable, enclose the value in quotation marks.

Nine

 Built-in objects are objects already provided in C #, such as Page,session,request, and object-oriented are all objects, including built-in objects and their own defined objects, such as
Class b{} This type B is a custom Object!

  

JS Learning Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.