Test 3 Flashcards
The JavaScript language is widely used for:
web-based client- side scripting
JavaScript essentially enables Web 2.0, the ________ side of the World Wide Web
dynamic
JavaScript is an implementation of __________ and developed by Brendan Eich & Netscape Communications Corporation in _____
ECMAScript
1995
JavaScript alternate names include:
___________,___________,_________
Microsoft calls their version:
Mocha, livescript, JavaScript
Jscript
JavaScript is only distantly related to the _______ programming language
The main similarity being its common debt to the ______ programming language
Java
C
What are the 2 ways to write JavaScript in an html document
Write JavaScript within a
element within the <head > element
Write JavaScript within a
element within the <body> element
JavaScript provides ________ methods to manipulate the output stream that represents the browser window
four (4)
What are the 4 methods to manipulate output on a browser window
1 method: opens wondow
2 methods: writes output in window
1 method: closes window
represents the browser window
It is a JavaScript object
document
Methods to open and close a browser window.
Open()
Close()
write a string a character to the browser window It does not generate a \n:
also writes a string of characters to the browser window It automatically generates a \n:
write()
writeln()
is a string containing the HTML markup and text to display in the browser window JavaScript strings are enclosed by “”
string
However , the \n is not interpreted by a web browser as a newline character If you want to insert a newline in a web page you must use a:
<br></br>
JavaScript provides ______ method to manipulate the output stream that represents a pop -up alert window
one (1)
Pop-up Alert Window method
window.alert (string )
_________ represents a pop-up alert window
It is a JavaScript object similar to _________
window
document
JavaScript identifiers:
Must start with letter, , or $
Can only have letters, digits,, and $
Cannot be JavaScript reserved word
Also case sensitive
JavaScript is a ____________ language !
loosely typed
JavaScript provides _____ method to obtain input from the user
one
Method to obtain input for user. method returns the value typed by the user
window.prompt (string)
Logical operators
And
Or
Not
&&
||
!
Comparison operators
Equal to
Exactly equal to
Not equal too
Not exactly equal too
==
!=
!==
The _______ statement will break the loop and continue executing the code that follows after the loop (if any).
The __________ statement will break the current loop and continue with the next value.
break
continue
The _______ statement loops through the elements of an array or through the properties of an object
for… in
All JavaScript functions return a:
The procedure (void return type) concept is not available in JavaScript, but it can be:
value
faked
Similar to identifiers, JavaScript _______ can be declared, or not, before use
The size of any JavaScript array can be resized on the _____, regardless of declared size
arrays
fly
identifiers can be assigned any primitive data type or object value
True
False
True
array elements cannot be assigned any primitive data type of object value
True
False
False
is an array containing one or more arrays.
multidimensional array
To create a two- dimensional array , add each array within its own set of:
curly braces
What are arrays with names indexes called?
Associated arrays or hashes
This is not allowed in javascript
Does JavaScript support arrays with named indexes?
NO
In JavaScript , arrays always use ________ indexes
numbered
As we have already discussed, the data contained within a HTML form is processed by the program defined by:
action=“”
The program resides on a web server and is written in a server-side programming language such as:
However JavaScript , is a client -side:
PHP, PERL, etc.
PL
JavaScript can be used to ensure that a HTML form is properly “_______” before it is submitted
filled out
However, data entered into an HTML form can be _________ and _________ by a JavaScript .
Additionally, your JavaScript can _______ data into an HTML form input or textarea element.
Requires a form ___!
retrieved and processed
write
Id
Each object provides several _________ to allow you to control the __________ and __________ of an object .
methods
attributes and behaviors
JavaScript provides the _________ object so you can manipulate the document that is currently visible in the browser window.
document
JavaScript provides the ________ object so you can manipulate a pop -up alert window .
window
JavaScript, like Java, provides many methods to manipulate String objects such as:
charAt()
substring()
toLowerCase()
toUpperCase()
JavaScript also provides methods to decorate HTML content, similar to the CSS text -decorate style:
anchor()
link()
strike()
sub()
sup()
fixed ()
JavaScript provides mathematical methods and constants through a ______ object .
Math
JavaScript provides the __________ object as an object wrapper for true/false values.
They include:
Boolean
toString() and valueOf()
JavaScript provides the ___________ object as an object wrapper for numeric values .
They include:
Number
toString() and valueOf()
The global ______ property is a value representing Not-A-Number.
NaN
Number.isNan ( ) method determines whether a value is:
The method returns _______ if the value equates to NaN Otherwise it returns _______.
an illegal number (Not-a-Number).
true
false
JavaScript provides the _________ object so you can manipulate the document that is currently visible in the browser window .
document
4 document object methods:
2 document properties:
Methods
document.open();
document.write(string_object);
document.writeln(string_object);
document.close();
Properties
document.lastModified
document.cookie
The __________ property refers to a String object that represents the date and time the document was last modified .
lastModified
small amounts of data stored by the web browser .
They allow you to store particular information about a user and retrieve it every time they visit your pages.
Cookies
The ________________ object property refers to a String object that represents the cookies stored on the user’s computer for the current document .
cookie document
The five cookie properties:
Name
Expires
Path
Domain
Secure
Sets cookies name and it’s value
Optional value sets date the cookie will expire
Optional value specifies path
Optional value specifies domain which cookie applies
Optional flag indicates browser should use secure sockets later
name=value
expires=date
path=path
domain=domain
Secure has no assigned value
Defines width different window in pixels.
Defines height of window in pixels.
Sets how far removed the window appears from the left of the screen in pixels.
Partner to left, pushes window off the top of screen.
No percentages on all!!!
width=pixel
height=pixel
left=pixel
top=pixel
Use this to control whether or not you want the user to be able to resize the window .
resizable= yes or no
This lets you decide whether or not to have scrollbars on the window.
If your content may be longer then the dimensions you’ve specified, make sure this is set to yes.
Scrollbars=yes or no
Specifies whether the basic back/forward toolbar should be visible.
If there are links to follow in your new page , set this to yes .
toolbar=yes or no
Specifies whether the location toolbar (address bar) is shown
location= yes or no
Specifies whether the directories toolbar is shown (Links toolbar in IE).
directories= yes or no
Specifies whether the new window can have a status bar.
Best set to yes .
For security reasons , Mozilla - based browsers always show the status bar.
status= yes or no
Specifies whether the main toolbar ( File, Edit, …) is shown .
menubar=yes or no
Whether or not to copy the old browser window’s history list to the new window.
copyhistory= yes or no
Netscape 4-only attribute which makes the popup dependent on the status of the main window .
If the main window is closed , the popup closes with it.
dependent= yes or no
Old Netscape attributes for defining the window’s position on the page in pixels.
Best to use left and top.
screenX and screenY
Internet Explorer- only Boolean attribute which may open the window in fullscreen
fullscreen = yes or no
method closes the specified browser window using the name of a specific window object name .
userWindowObject.close()
Based on hierarchy, a document is contained within a userWindowObject .
To write structure and content in the document contained within a specific window defined by a window object, we use this method
userWindowObject.document.writeln ()
If you write structure, content, and/or format to a window , use the following function to signify you’ve finished writing data to the document .
userWindowObject.document.close ();
The properties that can be defined when a window is opened (i.e. location, toolbars, etc.) can be reset after the window has been open.
userWindowObject.property = new_value ;
main page style is not carried through pop up.
You must write the ______ style information into the popup code if you want style!!!
CSS
trigger actions in the browser, like starting a JavaScript when a user clicks on an HTML element or a form button.
normally used in combination with functions, and the function will not be executed before the event occurs!
Events
DOM stands for:
Document object model
DOM is a Platform- and language -neutral interface that will allow programs and scripts to _________________ the content , structure and style of documents
dynamically access and update
DOM provides
- A standard set of ________ for representing HTML and XML documents
- A standard _________ for accessing and manipulating these documents record
objects
interface
is an alternative term used by some vendors to describe the combination of HTML, style sheets and scripts that allows documents to be animated
Dynamic HTML
is also used to refer to Dynamic HTML
Web 2.0
The DOM can be separated into three different parts
- Core
- XML
- HTML
defines a standard set of objects for any structured document:
defines a standard set of objects for XML documents
defines a standard set of objects for HTML documents
Core DOM
XML DOM
HTML DOM
The DOM views HTML documents as a _____ structure of elements
All elements , along with their attributes and content (if not empty), can be accessed and manipulated through the DOM _____
tree
tree
the Document object represents the entire HTML document
As with any class object, it has associated _____,_______,______
properties , methods , and arrays
There are several __________ Object arrays
The name of an array is an:
___________ object arrays are essentially collections” of element objects
Document
object
Document
Because the name of a ___________ Object array is an object, you can access certain properties with the array
Document
Returns a reference to all Anchor objects in the document
Returns a reference to all Image objects in the document
Returns a reference to all Form objects in the document
anchor[]
images[]
forms[]
Returns the date and time the document was last modified
lastModified
Specifies the beginning and end of the document body
Returns the document server’s domain name
Sets or returns all cookies associated with the document
Returns the URL of the document that loaded the current document
Returns the title of the document
Returns the URL of the current document
body
domain
cookie
referrer
title
URL
Returns a reference to the first object with the specified id= value
Returns a collection of objects (e.g. array ) with the specified name=value
Returns a collection of objects (e.g. array) with the specified tagname , where tagname is the actual name of an HTML element
getElementById(“value”)
getElementsByName (“value”)
getElementsByTagName (“tagname”)
The “__________” object represents the browser window
is created automatically with every instance of a < body> or < frame > element/tag
Window
A property that contains the current URL of the window
A property that returns the name of the window
A property that returns the interior width of the window in pixels
A property that returns the interior height of the window in pixels
A property that returns the outer width of the window in pixels
A property that returns the outer height of the window in pixels
window.location
window.name
window.innerWidth
window.innerHeight
window.outerWidth
window.outerHeight
This object gives you information about an event that has occurred
This object represents the state of an event , such as the element in which the event occurred , the state of the keyboard keys , the location of the mouse , and the state of the mouse buttons , etc.
Event
The Event object is available only during an:
That is, you can use it in __________ but not in ________
event
event handlers
other code
The Style object represents an individual _______ statement.
The Style object can be accessed from the __________ or from the ________ to which that style is applied.
style
document
elements
syntax for style using getId:
document.getElementById(“ID”).style.property = “value”;