您现在的位置是:主页 > 网站制作 > Js经典实例 >
js创建 对象 数组 日期
刘清2019-06-13 10:27【个人博客】人已围观
简介script people=new object(); people,name=java; people.age=30; document.write(name+people.name+,age:people.age); /script function people(name,age){ this.name=name; this.age=age; } son=new people(www,30); var str=hello world; doucument.write(字
<script>
people=new object();
people,name="java";
people.age="30";
document.write("name"+people.name+",age:"people.age);
</script>
function people(name,age){
this.name=name;
this.age=age;
}
son=new people("www",30);
var str="hello world";
doucument.write("字符串长度"+str.length);
doucument.write(str.indexOf("Hello"));
doucument.write(str.match("world1"));
doucument.write(str.replace("world","jikexueyun“));
doucument.write(str.toUpperCase());
var today=new Date();
var h=today.getHours();
var n=today.getMinutes();
var s=today.getSeconds();
m=checkTime(m)
s=checkTime(s);
doucument.getElementById("timetxt").innerHtml=h+":"+m+"+s;
t=setTimeout(function(){
startTime();
},2000);
}
function checkTime(i){
if(i<10){
i="0"+i;
}
return i;
}
Tags:
很赞额!(74)
上一篇:js按钮事件
下一篇:dom对象控制html元素