Skip to main content

Home/ Groups/ Learning Library
2More

JavaScript Switch Statement - 0 views

  • The JavaScript Switch Statement Use the switch statement to select one of many blocks of code to be executed. Syntax switch(n) { case 1:   execute code block 1   break; case 2:   execute code block 2   break; default:   code to be executed if n is different from case 1 and 2 }
  • Use break to prevent the code from running into the next case automatically.
8More

JavaScript Popup Boxes - 0 views

  • JavaScript has three kind of popup boxes: Alert box, Confirm box, and Prompt box.
  • Alert Box An alert box is often used if you want to make sure information comes through to the user. When an alert box pops up, the user will have to click "OK" to proceed.
  • Syntax alert("sometext");
  • ...5 more annotations...
  • <script type="text/javascript"> function show_alert() { alert("I am an alert box!"); } </script>
  • Confirm Box A confirm box is often used if you want the user to verify or accept something. When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed. If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box returns false. Syntax confirm("sometext");
  • <script type="text/javascript"> function show_confirm() { var r=confirm("Press a button"); if (r==true)   {   alert("You pressed OK!");   } else   {   alert("You pressed Cancel!");   } } </script>
  • Prompt Box A prompt box is often used if you want the user to input a value before entering a page. When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value. If the user clicks "OK" the box returns the input value. If the user clicks "Cancel" the box returns null. Syntax prompt("sometext","defaultvalue");
  • <script type="text/javascript"> function show_prompt() { var name=prompt("Please enter your name","Harry Potter"); if (name!=null && name!="")   {   document.write("Hello " + name + "! How are you today?");   } } </script>
16More

JavaScript Functions - 0 views

  • A function will be executed by an event or by a call to the function.
  • To keep the browser from executing a script when the page loads, you can put your script into a function.
  • A function contains code that will be executed by an event or by a call to the function.
  • ...13 more annotations...
  • You may call a function from anywhere within a page (or even from other pages if the function is embedded in an external .js file).
  • Functions can be defined both in the <head> and in the <body> section of a document. However, to assure that a function is read/loaded by the browser before it is called, it could be wise to put functions in the <head> section.
  • How to Define a Function Syntax function functionname(var1,var2,...,varX) { some code }
  • The { and the } defines the start and end of the function.
  • The parameters var1, var2, etc. are variables or values passed into the function.
  • A function with no parameters must include the parentheses () after the function name.
  • The word function must be written in lowercase letters, otherwise a JavaScript error occurs!
  • Also note that you must call a function with the exact same capitals as in the function name.
  • The return Statement The return statement is used to specify the value that is returned from the function. So, functions that are going to return a value must use the return statement.
  • <script type="text/javascript"> function product(a,b) { return a*b; } </script>
  • If you declare a variable, using "var", within a function, the variable can only be accessed within that function. When you exit the function, the variable is destroyed. These variables are called local variables.
  • You can have local variables with the same name in different functions, because each is recognized only by the function in which it is declared.
  • If you declare a variable outside a function, all the functions on your page can access it. The lifetime of these variables starts when they are declared, and ends when the page is closed.
11More

JavaScript Where To - 0 views

  • JavaScripts in a page will be executed immediately while the page loads into the browser.
  • Scripts to be executed when they are called, or when an event is triggered, are placed in functions.
  • put all your functions in the head section, this way they are all in one place and do not interfere with page content.
  • ...8 more annotations...
  • <head> <script type="text/javascript"> function message() { alert("This alert box was called with the onload event"); } </script> </head>
  • Scripts placed in the body section are often used to display page content while the page loads.
  • JavaScript can also be placed in external files.
  • External JavaScript files often contains code to be used on several different web pages.
  • External JavaScript files have the file extension .js
  • External script cannot contain the <script></script> tags!
  • To use an external script, point to the .js file in the "src" attribute of the <script> tag:
  • <script type="text/javascript" src="xxx.js"></script>
7More

JavaScript How To - 0 views

  • The HTML <script> tag is used to insert a JavaScript into an HTML page.
  • <script type="text/javascript"> document.write("Hello World!"); </script>
  • how to add HTML tags to the JavaScript: Example <html> <body> <script type="text/javascript"> document.write("<h1>Hello World!</h1>"); </script> </body> </html>
  • ...4 more annotations...
  • the <script type="text/javascript"> and </script> tells where the JavaScript starts and ends
  • The document.write command is a standard JavaScript command for writing output to a page.
  • By entering the document.write command between the <script> and </script> tags, the browser will recognize it as a JavaScript command and execute the code line.
  • Browsers that do not support JavaScript, will display JavaScript as page content. To prevent them from doing this, and as a part of the JavaScript standard, the HTML comment tag should be used to "hide" the JavaScript. Just add an HTML comment tag <!-- before the first JavaScript statement, and a --> (end of comment) after the last JavaScript statement
2More

JavaScript Introduction - 0 views

  • A scripting language is a lightweight programming language
  • Java and JavaScript are two completely different languages in both concept and design!

Bella Abzug - 0 views

Jane Addams - 0 views

Eleanor Baum - 0 views

Ruth Benedict - 0 views

Virginia Apgar - 0 views

3More

JavaScript for Loop - 0 views

  • Loops execute a block of code a specified number of times, or while a specified condition is true.
  • In JavaScript, there are two different kind of loops: for - loops through a block of code a specified number of times while - loops through a block of code while a specified condition is true
  • The for Loop The for loop is used when you know in advance how many times the script should run. Syntax for (variable=startvalue;variable<=endvalue;variable=variable+increment) { code to be executed }
2More

JavaScript while Loop - 0 views

  • The while Loop The while loop loops through a block of code while a specified condition is true. Syntax while (variable<=endvalue)   {   code to be executed   }
  • The do...while Loop The do...while loop is a variant of the while loop. This loop will execute the block of code ONCE, and then it will repeat the loop as long as the specified condition is true. Syntax do   {   code to be executed   } while (variable<=endvalue);
14More

W3Schools' Certifications - 0 views

  • Online Certification Program
  • Study at no cost
  • Study when it is convenient
  • ...11 more annotations...
  • Study from your own computer
  • HTML Developer Certificate
  • CSS Developer Certificate
  • JavaScript Developer Certificate
  • jQuery Developer Certificate
  • XML Developer Certificate
  • ASP Developer Certificate
  • PHP Developer Certificate
  • Documentation of your skills enables you to move upwards
  • Getting a certificate proves your commitment to upgrade your skills, gives you the credibility needed for more responsibilities, larger projects, and a higher salary.
  • documented knowledge is often the key factor when hiring new personnel
5More

HTML Colors - 0 views

« First ‹ Previous 101 - 120 Next › Last »
Showing 20 items per page