Monday, November 14, 2022

hobingodingcom

Antenna Yagi Calculator

visit us https://antenna-handbook.blogspot.com


Center Frequency

var c; var L; var freq; let c = 300000000;

Saturday, November 5, 2022

Creating the JavaScript Program File

The first step in running a JavaScript program is creating a file that contains the definitions of the functions, along with comments that give human readers a better understanding of what the program does. 
• Here, for example, is the complete HelloWorld.js file:

/* * File: HelloWorld.js * ------------------- 
* This program displays "hello, world" on the console. It
* is inspired by the first program in Brian Kernighan and 
* Dennis Ritchie's classic book, The C Programming Language. */
 
function HelloWorld() {
     console.log("hello, world"); 
}

Creating the HTML File (Version 1)

  • A simple HTML file that loads the HelloWorld.js program looks like this:
<!DOCTYPE html>
<html>
   <head>
      <title>Hello World</title>
      <script type="text/javascript" src="HelloWorld.js"></script>
</head>
<body onload="HelloWorld()"></body>
</html>

  • This file asks the browser to load the file HelloWorld.js and then call the function HelloWorld once the page is loaded.
  • The problem with this strategy is that it is hard "to find out where your output went" as Kernighan and Ritchie advise. 

Creating the HTML File (Version 2) 


• The output from the console log appears in different places in different browsers and usually requires the user to take some explicit action before it is visible. 
• To make the console log easier to find, we have provided a library called JSConsole.js that redirects the console log to a much more visible area of the web page.

<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
<script type="text/javascript" src="JSConsole.js"></script>
<script type="text/javascript" src="HelloWorld.js"></script>
</head>
<body onload="HelloWorld()"></body>
</html>

The Structure of an HTML File

  • An HTML file consists of the text to be displayed on the page, interspersed with various commands enclosed in angle brackets, which are known as tags.
  • HTML tags usually occur in pairs. The opening tag begins with the name of the tag. The corresponding closing tag has the same name preceded by a slash. The effect of the tag applies to everything between the opening and closing tag.
  • The only HTML tags you will need to use for most of the course appear in the template on the next page, which describes the structure of the HTML index file, which is conventionally called index.html
Standard index.html Pattern One or more script tags to load JavaScript code. Contents of the page, if any. 

 • The following components of index.html are standardized: 
– Every file begins with a  <!DOCTYPE html> tag
– The entire content is enclosed in <html> and </html> tags. 
– The file begins with a <head> section that specifies the title and JavaScript files to load. 
– The file includes a <body> section that specifies the page.
 
Structure html file