Summary of the knowledge learned in 7.25PHP

Source: Internet
Author: User
Tags close page

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.