HTML tags, JavaScript Functions Flashcards
displays the alert box containing message with ok button
alert()
displays the confirm dialog box containing message with ok and cancel button
confirm()
displays a dialog box to get input from the user.
prompt()
opens the window.
open()
closes the window.
close()
performs action after specified time like calling function, evaluating expressions etc
setTimeout()
JavaScript BOM (Browser Object Model)
- alert()
- confirm()
- prompt()
- open()
- close()
- setTimeout()
The ____ object represents the whole html document
Document
writes the given string on the document.
write(“string”)
writes the given string on the document with newline character at the end.
writeIn(“string”)
returns the element having the given id value.
getElementById()
WALANG “S” SA ELEMENT DITO HA!!!
returns all the elements having the given name value.
getElementsByName()
returns all the elements having the given tag name.
getElementsByTagName()
returns all the elements having the given class name.
getElementsByClassName()
The Access the target element(s) using methods:
- getElementById()
- getElementsByName()
- getElementsByClassName()
- getElementsByTagName()
Displays an alert dialog box with a message
alert()
Displays a dialog box to prompt the user for input.
prompt()
Displays a dialog box with a message and OK/Cancel buttons.
confirm()
Converts a string to an integer.
parseInt()
Converts a string to a floating-point number.
parseFloat()
Converts a value to a string
String()
Converts a value to a number.
Number()
Checks if a value is NaN (Not-a-Number).
isNaN()
Generates a random number between 0 and 1.
Math.random()
Rounds a number down to the nearest integer
Math.floor()
Rounds a number up to the nearest integer.
Math.ceil()
syntax changes the text content of the specified element to the provided value.
textContent
element.textContent = ‘New text content’;
syntax changes the HTML content of the specified element. It can include tags and will be rendered as HTML.
innerHTML
element.innerHTML = ‘< strong >New HTML content
< /strong >’;
method searches a string for matches against a regex pattern and replaces them with a specified replacement string
replace()
method checks whether a given string matches a specified regex pattern. It returns a boolean value indicating whether the pattern is found or not.
test()
method searches a string for matches against a regex pattern and returns an array of the matched results.
match()
method splits a string into an array of substrings based on a specified regex pattern.
split()
method searches a string for a specified regex pattern and returns the index of the first match found. If no match is found, it returns -1.
search()
JavaScript built-in methods for Regular Expression:
- test()
- match()
- replace()
- split()
- search()