IES: JS-deck 8 Flashcards
HTML innerHeight
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- returns the height of a window’s content area: read only
- Syntax
window.innerHeight
ORinnerHeight
- Example
let height = window.innerHeight;
(get the window height)
HTML innerWidth
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- returns the width of a window’s content area: read only
- Syntax
window.innerWidth
ORinnerWidth
- Example
let height = window.innerWidth;
(get the window width)
HTML layer
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- positions and animates (through scripting) elements
- separate doc on top of the main one, all in one window
- deprecated
- Syntax
~~~
<layer>
<p>layer 1</p>
</layer>
* Example
<!DOCTYPE html>
<html>
<head>
<title>HTML layer Tag</title>
</head>
<body>
<layer>
<p>layer 1</p>
</layer>
<layer id = "layer2"
...
<p>layer 2</p>
</layer>
<layer id = "layer3"
...
<p>layer 3</p>
</layer>
</body>
</html>
~~~
HTML layers
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- positions and animates (through scripting) elements
- separate doc on top of the main one, all in one window
- deprecated
- Syntax
~~~
<layer>
<p>layer 1</p>
</layer>
* Example
<!DOCTYPE html>
<html>
<head>
<title>HTML layer Tag</title>
</head>
<body>
<layer>
<p>layer 1</p>
</layer>
<layer id = "layer2"
...
<p>layer 2</p>
</layer>
<layer id = "layer3"
...
<p>layer 3</p>
</layer>
</body>
</html>
~~~
HTML link
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- allow users to click their way from page to page
- Syntax
<a href="url">link text</a>
- Example
<a href="https://www.w3schools.com/">Visit W3Schools.com!</a>
HTML location
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- contains info about current URL
- a property of the window object
- Syntax
window.location
ORlocation
- Examples
let origin = window.location.origin;
&let origin = location.origin;
HTML mimeTypes
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- MIME: Multi-purpose Internet Mail Extensions
- A standard way of classifying file types on the internet
- consists of two parts: a type and a subtype (text/html)
- Syntax
type "/" [tree "."] subtype ["+" suffix]
- Example
application/vnd.api+json
(This is an API-specific MIME type, and it refers to JSON API :
In this example, we have “application” as the type and “api” as the subtype. The “vnd.” is the vendor prefix while the “+json” is the suffix, indicating that it can be parsed as JSON.)
HTML navigate
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- The
<nav>
tag defines a set of navigation links: The<nav>
element is intended only for major blocks of navigation links. - Default CSS Settings
~~~
nav {
display: block;
}
~~~ - Example
~~~
<nav>
<a>HTML</a> |
<a>CSS</a> |
<a>JavaScript</a> |
<a>Python</a>
</nav>
~~~
(a set of navigation links)
HTML navigator
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- contains browser info
- is a window object property
- Accessed with
window.navigator
ORnavigator
- Examples
let url = window.navigator.language;
&let url = navigator.language;
HTML frames
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- defines one particular window (frame) within a
<frameset>
- NOT SUPPORTED IN HTML5
- Divides browser window into multiple sections: each can load a separate HTML doc independently.
- Collection of frames in browser window known as frameset.
- Window divided similar to table organization: rows/columns
HTML frameRate
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- the speed at which images, called frames, appear on a display
- measured in frames per second (FPS): Specifies the number of frames to be displayed every second
~~~ - Syntax
frameRate( c )
~~~
(c = number of times a second an attempt will be made to refresh the display) - Example
~~~
function setup() {
// Create canvas of given size
createCanvas(500, 200);
// Set the font size
textSize(20);
// Use frameRate() function
frameRate(3);
}
function draw() {
// Set the background color
background(0, 153, 0);
// Display the output
text(“Frame Count with frameRate “ +
int(getFrameRate()), 100, 100);
}
~~~
HTML hidden
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- a Global Attribute
- A Boolean value
- When present, specifies is not yet, or is no longer, relevant
- Browsers don’t display when hidden attribute is specified
- Can keep hidden until condition is met (checkbox, etc.)
- JS can remove
- Example
<p hidden>This paragraph should be hidden.</p>
HTML history
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- Property of the Window Object: contains the URLs visited
- Access with:
window.history
or justhistory
- Examples
1.let length = window.history.length;
2.let length = history.length;
HTML image
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- used to embed an image in a web page.
- Not technically inserted into, images are linked to web pages: The tag creates a holding space for the referenced image.
- Tag is empty, it contains attributes only: It has two required attributes.
1. src - Specifies the path to the image
2. alt - Specifies an alternate text for the image - Syntax
<img src="url" alt="alternatetext">
- Example
<img src="img_chania.jpg" alt="Flowers in Chania">
HTML images
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- used to embed an image in a web page.
- Not technically inserted into, images are linked to web pages: The tag creates a holding space for the referenced image.
- Tag is empty, it contains attributes only: It has two required attributes.
1. src - Specifies the path to the image
2. alt - Specifies an alternate text for the image - Syntax
<img src="url" alt="alternatetext">
- Example
<img src="img_chania.jpg" alt="Flowers in Chania">