What is a stub page?
Answer: a stub page is a placeholder the actual page (in this case your proj1a or proj1b index.html
page. The stub page is used to check if the hyperlinks from the Project 0 index page to the stub page
and from the stub page back to the Project 0 index page work. These stub pages will be replaced
with the actual Project 1a and 1b pages when they are completed.
What is an entity? What are some common HTML entities that you know? Answer: An HTML entity
is a symbol that cannot be directly represented by a keyboard character.
It is of the form &entity_name; Here are some common
entities:
Entity Symbol
< <
> >
& &
" "
' '
nonbreaking space
β β (Greek letter beta)
→ → (right arrow)
← ← (left arrow)
“ “ (left double quotes)
Answer: The label control has two effects: (1) when the label of a textfield
is clicked, the focus goes to the corresponding textfield. Having the
focus means that that when the user types at the keyboard, the typed text
is entered in the textfield with the focus.
(2) When a screen reader is running and a textfield is clicked or arrived at via
tabbing, the contents of the textfield and the label of the textfield are read.
What is the difference between these two HTML tags?
Answer:
Basically they mean the same thing. However, with the
<button> tag, you can place additional HTML markup between the start and end
tags like this:
You can't put HTML markup in the value attribute of the <input> tag.
What is JavaScript?
In September 1995 JavaScript was created in 10 days by Brendan Eich of
Netscape Communications.
It is a lightweight scripting language, used to build websites -- about 1.52
billion of them, 95% of all websites.
Originally, the name of JavaScript was Mocha. It was designed as a web
scripting companion to Java.
The name Mocha was changed to LiveScript for marketing purposes.
In 1998, AOL acquired Netscape and formed an alliance with Sun Microsystems
to develop web software. At that time that the name of LiveScript was
changed to JavaScript. This was a marketing ploy, based on the popularity of Java.
JavaScript and Java are very different, but the two languages have many
syntax elements in common.
ECMAScript (starting in 1997) is a standard for JavaScript, which is meant
to ensure the interoperability of web pages across different browsers. ECMA
means European Computer Manufacturers Association.
JavaScript Output
Hello World Example
Here are four ways in JavaScript to output text:
Using the Chrome Browser, click on the three dots icon in the upper right
corner; Select More tools >> Developer tools. In the HTML code
for Item 1, replace the line
document.writeln("Hello, World.");
with
console.log("Hello, World.");
Refresh the browser.
Writing to the browser console is useful for debugging.
Display a popup window
In the HTML code for Item 1, use
alert("Hello, World.");
instead of
console.log("Hello, World.");
Display Output in a Textfield
You already know how to do this from IT 130. We will look
at other possibilities this later.
Functions
A function is a set of statements designed to perform a task.
A function must be called or invoked to execute the statements.
Test this function that converts a length from inches
to centimeters:
// BasicFunction Example
// Function definition:
function inToCm(inches) {
cm = inches * 2.54;
return cm;
}
// Function test:
var inches = prompt("Enter length in inches", "0");
var cm = inToCm(inches);
document.writeln("Length in cm: " + cm);
// If input is 2, the output is 5.08
Why are the outputs on the same line?
I thought that writeln puts a newline
character (\n) at the end of its output. Place these statements
in this test script before viewing the HTML page:
<html>
<body>
<script>
// Copy JavaScript code to test here.
</script>
</body>
</html>
Answer: Just because the HTML code goes to a new line doesn't mean
that the browser will display it on a new line. The \n character counts
as whitespace that is eliminated by the browser.
You need <br> to force
the browser display to go to a new line: