从头开始学JavaScript(第六天)

第六天学习的内容有:


1.Date类 其中方法有:getMonth(),getDate(),getFullYear();

2.数组的sort()方法

3.string类 其中的属性有:length
其中的方法有:indexOf(),charAt(),tolowerCase(),toUpperCase()

4.math类 其中的属性有:PI
其中的方法有:round(),floor(),ceiling(),random()

5.this用来把function转化为method

6.JavaScript创建类方式:

function Blog(body,date){

this.body =body;
this.date =date;


this.toString()=function(){
}


}

7.prototype用来声明和获得类变量和类方法(不是实例)

8.声明类方法:类名.方法名=function(){}


----------ajax--------------
9.readyState:0,1,2,3,4,5

10.status:200,404

11.创建xmlhttprequest对象
var request = null;
if(window.XMLHttpRequest){
try{
request = new XMLHttpRequest();
}catch(e){
request = null;
}
else if(window.ActiveXObject){
try{
request = new ActiveXObject("Msxml2.XMLHttp");
}catch(e){
try{
request = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
request = null;
}
}
}

12.request.onreadystatechange = 自定义回调方法(注意:只要写方法名不需要括号)
request.open(type,url,true)
type:1.get:不改变服务器上数据时使用
2.post:要改变服务器上数据时使用

request.send()方法只有1个参数,就是要传到server的数据,如果url后已经拼接过数据
则只要传入null就可以了

13.function updatePage() {
if (request.readyState == 4)
if (request.status == 200)
alert("Server is done!");
}
============================完===========================
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值