HTML & CSS Layout Template
You can use the code below to set up an HTML document with a CSS layout including header, footer, sidebar, horizontal navigation menu, and single-column main content area. Here is …
You can use the code below to set up an HTML document with a CSS layout including header, footer, sidebar, horizontal navigation menu, and single-column main content area. Here is …
A for loop is a type of loop that can repeat a block of code a set number of times. For example, you could use a for loop with a counter …
Unlike the regular while loop, a do..while loop will run the block of code in the loop first and then check if the condition evaluates to true before it runs again (rather …
A while loop runs a set of instructions (block of code) while a test condition evaluates to true. A while loop can repeat a set of instructions over and over …
A switch statement is like an IF statement but is neater when working with many conditions. Use the break statement at the end of each case so that the code …
Using logical operators such as and/or allow a programmer to write complex if statements. For example, you can check if a number is greater than 10 AND is also less than 20 …
The sample code below shows how to use if statements inside other if statements (nested if statements). The video here explains all about nested if statements! <!DOCTYPE html> <html lang="en" …
Often when using if statements, you will want to test more than just one condition. The sample code below explains how to do this. You can also watch the video …
An ‘if statement’ is used to test a condition. If the test condition evaluates to true (Eg. x is less than y), then the code inside the if statement will run. …
Sometimes you might need to find out how many elements exist in an array (that is, the length of the array). The sample code below shows exactly how to do …
Arrays are very useful in any programming language. When you use a simple variable, you can only store one value. For example age = 17 or name = “Harry”. But …
In the previous sample code, we looked at how to use a parameter in a function. This sample code shows how to use multiple parameters. Make sure you also watch …
The sample code shows how to make a function which uses a parameter. A parameter is like a special variable which is used in a function to refer to a piece of data …
This sample code snippet shows how to work with events (eg. onclick and onmouseover). It also shows how to use those annoying alert messages…but please, only use them for good! …
Quite a lot is going to be covered in the source code snippet below. You might want to watch the video which explains all about working with strings by clicking …