Jsdom knowledge
Composition: ECMAscript, BOM, DOM
ECMAscript: Grammar Core
BOM: Browser Object model
window: Windows
Open Close
Timer: There is a return object that returns the timer.
(1) window.setinterval ();//serial Bomb ==> interval execution
(2) window.settmeout ();//Time Bomb ==> deferred execution
Settmeout (function () {},1000);
Clear timer: (1). cleartmeout Clear Tmeout Timer
(2). Clearinterval Clear Interval Timer
Histroy: Historical records
Go ( -1) back ()
Location: Address bar
Location (JS page jump) href= "" Replace ()
Document: Documents
DOM: Document Object Model
Core idea: Find elements, manipulate elements
JS Find element: returns the Element object
document.getElementById (); Uniquely determined
Document.getelementsbyname ();//name's property value returns an array
document.getElementsByTagName ();//tagname's label name Returns an array
Document.getelementsbyclassname (); The property value of the ClassName class returns an array
JS Action elements:
Manipulating element content:
Non-form elements: dom.innerhtml
Form elements: Dom.value
Action Element Properties:
Dom.getattribute ();//Get property value
Dom.setattribute ();//Set property value
Dom.removeattribute ();//Remove attribute values
manipulating element styles:
Dom.style.color =red
Manipulating element Events
Action element Add Delete
Open page
var w=[];
function Tiaozhuan () {
for (Var i=0;i<10;++i) {
W[i]=window.open ();
}
}
Close page
function Close () {
for (Var i=0;i<10;++i) {
W[i].close ();
}
}
Page loading complete
Window.onload=function () {
Alert ("Page load Complete");
}
//Time Date object
var dd = new Date (),
year = Dd.getfullyear (),//Years
month = "0" + (+dd.getmonth () +1),//month
date = Dd.getdate (),//day
hours = dd.gethours (),//When
minutes=dd.getminutes (),//min
seconds=dd.getseconds (),//sec
var str = y+ '-' +m+ '-' +d+ ' +h+ ': ' +f+ ': ' +s;
document.write (str);
Dom Operation Example
<button id= "One" > Point me </button>
<button id= "" "Style=" Display:none "> Invisible </button>
<script>
var Btn1=document.getelementbyid ("both");
Btn1.setattribute (' OnClick ', ' showtwo () ');
The ID is the default hidden click one to show the both elements
function Showtwo () {
Find element with ID of
var btn=
document.getElementById ("both");
if (btn.style.display== "block") {
Btn.style.display= "None";
}else{
btn.style.display= "Block";
}
}
</script>
Summary of the knowledge learned in 7.25PHP