HTML
1、 , 。
2、 :
Html
:
- Html ( ) ******
- , html (Web )
3、
- , ( , socket )
- pycharm
4、 Html
- doctype
- html , ====> , ==>html ,lang="en" html 。
- :
5、
-
, , 。
:
-
:
6、
- , , , , ,IE
6.1 :
6.2 : 5 baidu.com
6.3 : 30
6.4 :
6.5 :
6.6 :
- title ,
- ,
-
//javascript
:js ,html
Title
: , console
:
js head , , js js html
3.2 js :
//
/* */
3.3 js :
3.4 :
python :
name = "xiaoming"
js :
name = "xiaoming" #
var name = "xiaoming" # , , var
3.5 :
:
:
null、undefinednull JavaScript , , “ ”。
undefined , 。
3.5.1
JavaScript ,JavaScript 。
:
parseInt(..) , NaN
parseFloat(..) , NaN
:
NaN, 。 isNaN(num) 。
Infinity, 。 isFinite(num) 。
:
3.5.2
, JavaScript : , JavaScript 。
:
obj.length
obj.trim()
obj.trimLeft()
obj.trimRight)
obj.charAt(n) n ,n
obj.concat(value, ...)
obj.indexOf(substring,start) ,
obj.lastIndexOf(substring,start)
obj.substring(from, to) ,from ,to
obj.slice(start, end)
obj.toLowerCase()
obj.toUpperCase()
obj.split(delimiter, limit)
obj.search(regexp) , (g )
obj.match(regexp) , g , 。
obj.replace(regexp, replacement) , g , ,
$ : n ;
$&: ;
$`: ;
$':
$$: $
3.5。3
JavaScript Python
obj.length
obj.push(ele)
obj.pop()
obj.unshift(ele)
obj.shift()
obj.splice(start, deleteCount, value, ...) 、
obj.splice(n,0,val)
obj.splice(n,1,val)
obj.splice(n,1)
obj.slice( )
obj.reverse( )
obj.join(sep)
obj.concat(val,..)
obj.sort( )
3.5.4
a={'k1':'v1','k2':'v2'}
a[k1], v1
3.5.5
, Python 。
==
!=
===
!===
||
&&
3.6 For
a=[11,22,33,44]
for (item in a){
console.log(a[item]);
}
b={'k1':'v1','k2':'v2'}
for (item in b){
console.log(b[item])
}
3.7
:
if( ){
}else if( ){
}else if( ){
}else{
}
:
==
!=
=== ,
!==
|| , python or
&& , python and
:
function func(){
...
}
4、Dom
:
http://www.cnblogs.com/wupeiqi/articles/5643298.html
4.1
4.1.1 $('#id') $('.c1').siblings()
document.getElementById ID
document.getElementsByName name ( )
document.getElementsByClassName class
document.getElementsByTagName
var obj = document.getElementById('i1')
:
innerText
innerHTML
value
input value
select value (selectedIndex)
textarea value
4.1.2
, ;
var tag = document.getElementById('i1') // id=i1
var content = tag.parentElement // i1
parentElement //
children //
firstElementChild //
lastElementChild //
nextElementtSibling //
previousElementSibling //
parentNode //
childNodes //
firstChild //
lastChild //
nextSibling //
previousSibling //
4.2 :
4.2.1
var tag = document.getElementById('i1') // id=i1
var content = tag.innerText // i1
innerText
outerText
innerHTML HTML
innerHTML
value
input value
select value (selectedIndex)
textarea value
4.2.2 :
className
classList
classList.add
classList.remove
obj.style.fontSize = '16px';
obj.style.backgroundColor = 'red';
obj.style.color = "red"
4.2.3
attributes //
setAttribute(key,value) //
getAttribute(key) //
removeAttribute
/*
var atr = document.createAttribute("class");
atr.nodeValue="democlass";
document.getElementById('n1').setAttributeNode(atr);
*/
innerText
checkbox:
checked
className
classList
4.2.4 , HTML :
a.
b.
document.createElement('div')
4.2.5
DOM
document.geElementById('form').submit()
4.2.6 :
console.log()
alert
var v = confirm( ) v:true false
location.href
location.href = "" # ,
location.reload() #
location.href = location.href location.reload()
var o1 = setInterval(function(){}, 5000)
clearInterval(o1);
var o2 = setTimeout(function(){}, 50000);
clearTimeout(o2);
var obj = setInterval(function(){
}, 5000)
clearInterval(obj);
:
onclick,onblur,onfocus
?
js css html
:
a. onclick='xxx()' onfocus
。。。。
b. Dom ,
document.getElementById('xx').onclick
document.getElementById('xx').onfocus
this,
a.
function ClickOn(self){
// self
}
b.
document.getElementById('i1').onclick = function(){
// this
}
:
var myTrs = document.getElementsByTagName("tr");
var len = myTrs.length;
for(var i=0;i
function f1(){
console.log(1);
}
// ,5000 , 5 alert , , 123
setInterval("alert(123)",5000);
4.2.8 :
alert()
console.log()
4.3
:
:
className
classList
classList.add
classList.remove
obj.style.fontSize = '16px';
obj.style.backgroundColor = 'red';
obj.style.color = "red"
:
attributes
getAttribute
removeAttribute
, HTML :
a.
b.
document.createElement('div')
DOM
document.geElementById('form').submit()
:
console.log()
alert
var v = confirm( ) v:true false
location.href
location.href = "" # ,
location.reload() #
location.href = location.href location.reload()
var o1 = setInterval(function(){}, 5000)
clearInterval(o1);
var o2 = setTimeout(function(){}, 50000);
clearTimeout(o2);
var obj = setInterval(function(){
}, 5000)
clearInterval(obj);
5
function func(){
// id ,
var tag = document.getElementById('i1');
//
var content = tag.innerText;
var f = content.charAt(0);
var l = content.substring(1,content.length);
var new_content = l +f ;
tag.innerText = new_content;
}
//
setInterval("func()",500);
6、for
for(var item in [11,22,33]){
console.log(item);
continue;
}
var arra = [11,22,32,3]
for(var i=0;i