IES: JS-deck 7 Flashcards
1
Q
HTML confirm
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- displays dialog box & message, OK button, & Cancel button: often used to verify or accept something
- don’t overuse: prevents access to parts of page until closed
- Syntax
confirm(message)
- Example
let text; if (confirm("Press a button!") == true) { text = "You pressed OK!"; } else { text = "You canceled!"; }
2
Q
HTML constructor
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- creates and initializes an object instance of a class
- create a new object and set values for any existing object properties
- Syntax (JS)
constructor(parameters)
- Example (JS)
class Car { constructor(brand) { // Constructor this.carname = brand; } } mycar = new Car("Ford");
3
Q
HTML crypto
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- JavaScript is one of the primitive languages used in cryptocurrency blockchain development
- HTML is used in crypto coding specifically for the front end of decentralized applications (dApps) defining the structure of web pages
4
Q
HTML decodeURI
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- (JS Global Method) decodes a URI
- Syntax
decodeURI(uri)
- Example
let uri = "my test.asp?name=ståle&car=saab"; let encoded = encodeURI(uri); let decoded = decodeURI(encoded);
(Decode a URI after encoding it)
5
Q
HTML decodeURIcomponent
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- (JS Global Method) decodes a URI component
- Syntax
decodeURIComponent(uri)
- Example
let uri = "https://w3schools.com/my test.asp?name=ståle&car=saab"; let encoded = encodeURIComponent(uri); let decoded = decodeURIComponent(encoded);
(decode a URI after encoding it)
6
Q
HTML defaultStatus
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- Deprecated: Remove to prevent RUN-TIME ERRORS in future
- Syntax
window.defaultStatus
- Example
window.defaultStatus = "Default text in the status bar!"
7
Q
HTML document
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- File using HTML to structure & define web page content
- Example
<html> <head> <title>Href Attribute Example</title> </head> <body> <h1>Href Attribute Example</h1> <p> <a href="https://www.freecodecamp.org/contribute/">The freeCodeCamp Contribution Page</a> shows you how and where you can contribute to freeCodeCamp's community and growth. </p> </body> </html>
8
Q
HTML element
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- defined by a start tag, some content, and an end tag
- Empty elements have no content (<br></br>) and no end tag
- Syntax
Regular element<tagname>Content goes here...</tagname>
Empty element<tagname>attribute1 attribute2...<!--no content / end tag-->
- Example
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>This is a Heading</h1> <p>This is a paragraph.</p> <br> <!--above-empty element; this comment code readers ignore--> </body> </html>
9
Q
HTML elements
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- defined by a start tag, some content, and an end tag
- Empty elements have no content (<br></br>) and no end tag
- Syntax
Regular element<tagname>Content goes here...</tagname>
Empty element<tagname>attribute1 attribute2...<!--no content / end tag-->
- Example
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>This is a Heading</h1> <p>This is a paragraph.</p> <br> <!--above-empty element; this comment code readers ignore--> </body> </html>
10
Q
HTML embed
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- defines container for external resource, such as web page, picture, media player, or plug-in application
- WARNING: most browsers no longer support plugins
- Example
<embed type="image/jpg" src="pic_trulli.jpg" width="300" height="200">
(an embedded image)
11
Q
HTML embeds
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- defines container for external resource, such as web page, picture, media player, or plug-in application
- WARNING: most browsers no longer support plugins
- Example
<embed type="image/jpg" src="pic_trulli.jpg" width="300" height="200">
(an embedded image)
12
Q
HTML encodeURI
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- (JS Global Method) encodes a URI
- Syntax
encodeURI(uri)
- Example
let uri = "my test.asp?name=ståle&car=saab"; let encoded = encodeURI(uri);
(encode a URI)
13
Q
HTML encodeURIcomponent
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- (JS Global Method) encodes a URI component
- encodes special characters including: , / ? : @ & = + $ #
- Syntax
encodeURIComponent(uri)
- Example
let uri = "https://w3schools.com/my test.asp?name=ståle&car=saab"; let encoded = encodeURIComponent(uri);
(encodes a URI)
14
Q
HTML escape
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- aka- “HTML encoding” converts characters & symbols into HTML entity equivalents: Special characters, such as < and >, replace with corresponding HTML entities, such as
<
and>
.
15
Q
HTML event
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- HTML can let events trigger actions in a browser, like starting a JS when an element is clicked.
- Example
Attribute:onerror
Value: script
Description: Script to be run when an error occurs
16
Q
HTML fileUpload
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- Used to access a file or create a point of access for a file
- Examples
1. Access an input fileUpload objectvar x = document.getElementById("myFile");
2. Create an input fileUpload object
var x = document.createElement("INPUT"); x.setAttribute("type", "file");
17
Q
HTML focus
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- Gives focus to an element (if possible)
- Syntax
element.focus()
- Example
document.getElementById("myAnchor").focus();
(give focus to an element)
18
Q
HTML form
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- Creates an HTML form for user input: most often sent to a server for processing
- This element is a container for different types of input elements, such as: text fields, checkboxes, radio buttons, submit buttons, etc.
- Syntax
<form> . form elements . </form>
- Example
<form> <label for="fname">First name:</label><br> <input type="text" id="fname" name="fname"><br> <label for="lname">Last name:</label><br> <input type="text" id="lname" name="lname"> </form>
(A form with input fields for text)
19
Q
HTML forms
A
- HTML Name, Window Object, or Property
- JS significant: avoid for variable/function names
- Creates an HTML form for user input: most often sent to a server for processing
- This element is a container for different types of input elements, such as: text fields, checkboxes, radio buttons, submit buttons, etc.
- Syntax
<form> . form elements . </form>
- Example
<form> <label for="fname">First name:</label><br> <input type="text" id="fname" name="fname"><br> <label for="lname">Last name:</label><br> <input type="text" id="lname" name="lname"> </form>
(A form with input fields for text)
20
Q
HTML frame
A
- 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