JavaScript is a scripting language that belongs to the web!
JavaScript is a lightweight programming language.
JavaScript is a programmatic code that can be inserted into an HTML page.
When JavaScript is inserted into an HTML page, it can be performed by all modern browsers.
(Ps:javascript and Java are two completely different languages, both conceptually and in design.)
Java (by Sun invention) is a more complex programming language.
ECMA-262 is a JavaScript the official name of the standard.
JavaScript by Brendan Eich inventions. It appeared in 1995 in Netscape (the browser has stopped updating) and was in the 1997 Year by the ECMA (a standard association) adopted. )
HTML the script in must be between <script> and </script> tags.
The script can be placed in the <body> and
<type= "Text/javascript"></script >
Output:
Manipulating HTML elementsIf you want to access an HTML element from JavaScript, you can use the document.getElementById (ID) method.
<!DOCTYPE HTML><HTML><Body><H1>My First Web Page</H1><PID= "Demo">My First Paragraph</P><Script>document.getElementById ("Demo"). InnerHTML="My First JavaScript";</Script></Body></HTML>
(JavaScript is performed by a Web browser.) In this case, the browser will access the HTML element of id= "demo" and replace its contents (InnerHTML) with "My first JavaScript". )
Write to document outputThe following example writes the <p> element directly to the HTML document output:
<!DOCTYPE HTML><HTML><Body><H1>My First Web Page</H1><Script>document.write ("<p>my First javascript</p>");</Script></Body></HTML>
WarningPlease use document.write () to write only to the document output.
If document.write is executed after the document has finished loading , the entire HTML page will be overwritten:
<!DOCTYPE HTML><HTML><Body><H1>My First Web Page</H1><P>My first Paragraph.</P><Buttononclick= "myFunction ()">Click here</Button><Script>functionmyFunction () {document.write ("Oh, crap! The document disappears. ");}</Script></Body></HTML>
Front-end notes (3. JavaScript 1)