ICT EXAM 2ND QUARTER

Subdecks (1)

Cards (54)

  • JavaScript is a popular general-purpose scripting language used to put energy and pizzas into otherwise dead Web pages by allowing a static page to interact with users and respond to events that occur on the page.
  • JavaScript is not Java. Java was developed at Sun Microsystems. JavaScript was developed at Netscape. Java applications are independent of a Web page whereas JavaScript programs are embedded in a Web page and must be run in a browser window.
  • JavaScript is not HTML, but JavaScript code can be embedded in an HTML document and is contained within HTML tags. JavaScript has its own syntax rules and expects statements to be written in a certain way. JavaScript doesn't understand HTML, but it can contain HTML content within its statements.
  • he document.write() method does not produce a newline at the end of the string it displays. HTML tags are sent to the HTML renderer as the lines are parsed.
  • The document.writeln() method doesn't produce a newline either, unless it is in an HTML <pre> tag.
  • JavaScript programs are embedded in an HTML document between HTML head tags <head> and </head> or between the body tags <body> and </body.
  • Many developers prefer to put JavaScript code within the <head> tags, and at times, it is the best place to store function definitions and objects.
  • If you want text displayed at a specific spot in the document, you may want to place the JavaScript code within the <body>.
  • You may have multiple scripts within a page, and place the JavaScript code within both the <head> and <body> tags.
  • A JavaScript program starts with a <script> tag, and ends with a </script> tag.
  • If the JavaScript code is going to be long and involved, or may be reused, it can be placed in an external file (ending in .js) and loaded into the page.
  • The document.write() method does not produce a newline. The <br> tag takes care of that. userAgent is a special navigator property that tells you about your browser.
  • Again, the document.write() method does not produce a newline at the end of the string. The <br> tag is added to produce the line break.
  • The HTML <pre> tag starts a block of preformatted text; i.e., text that ignores formatting instructions and fonts.
  • The first JavaScript program ends here.
  • This tag marks the end of the JavaScript code.When enclosed in a <pre> tag, the writeln() method will break each line it prints with a newline; otherwise, it behaves like the write() method (i.e., you will have to add a <br> tag to get a newline).
  • This JavaScript program is placed within the document head. Since the head of the document is processed before the body, this assures you that the variable definitions will be defined first.
  • The process of joining strings together is called concatenation. The string concatenation operator is a plus sign (+).
  • The string concatenation operator is a plus sign (+). Its operands are two strings. If one string is a number and the other is a string, JavaScript will still concatenate them as strings. If both operands are numbers, the + will be the addition operator. The following examples output "popcorn" and "Route 66", respectively.
  • Variables are fundamental to all programming languages. They are data items that represent a memory storage location in the computer. Variables are containers that hold data such as numbers and strings.
    1. A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating forms, ad infinitum. But in order to do anything, the program works with the data that is given to it. Data types specify what kind of data, such as numbers and characters, can be stored and manipulated within a program. JavaScript supports a number of fundamental data types.numeric2. string3. Boolean
  • The dialog boxes are created with 3 methods: alert, confirm, prompt
  • The alert method creates a little independent box called a dialog box which contains a small triangle with an exclamation point
  • A user-customized message is placed after the triangle in an alert box
  • In an alert method shows an OK button beneath the User-customized message
  • All execution is stopped when a dialog box appears until the user presses the OK button
  • The message of the alert box is enclosed with a double quotation in a single argument.
  • HTML tags are not rendered inside dialog boxes but you can use escape sequences which are: \n or \n\ and \t
  • JavaScript methods are actions that can be performed on objects. A JavaScript method is a property containing a function definition
  • Dialog box is independent of its current document
  • The prompt dialog box pops up with a simple textfield box
  • The prompt dialog box contains 2 arguments
  • the second still in a prompt dialog box is a string of text which is the initial default setting for the box
  • the first string in the prompt box is a message normally displayed as a question to the user
  • In a prompt method, the return value of the OK button is True
  • In a prompt method, the value of Cancel is Null
  • In a confirm method, the return value of Cancel is False
  • Data objects can be manipulated in a number of ways by the large number of operators provided by JavaScript.
  • An operator manipulates data objects called operands;
  • Operators and operands are found in expressions. An expression combines a group of values to make a new value, n = 5 + 4. And when you terminate an expression with a semicolon, you have a complete statement (e.g., n = 5 + 4;)