var attime;
function clock(){
var time=new Date();
attime= time.getHours()+":"+time.getMinutes()+":"+time.getSeconds();
document.getElementById("clock").value = attime;
}
setInterval(clock,1000);
搞定
function clock(){
var time=new Date();
attime= time.getHours()+":"+time.getMinutes()+":"+time.getSeconds();
document.getElementById("clock").value = attime;
}
setInterval(clock,1000);
搞定
2019-07-23
<a href="javascript:window.history.go(-1);">返回</a>
var num = 5;
function Count(){
document.getElementById("count").value = num;
num = num-1;
if(num<=0){
location.href = "http://www.imooc.com";
}
setTimeout("Count()",1000)
}
Count();
var num = 5;
function Count(){
document.getElementById("count").value = num;
num = num-1;
if(num<=0){
location.href = "http://www.imooc.com";
}
setTimeout("Count()",1000)
}
Count();
//创建数组
var arr = ['*','##','***','&&&','****','##*'];
//显示数组长度
alert("数组的长度为"+arr.length);
//将数组内容输出,完成达到的效果。
document.write(arr[0]"<br>");
document.write(arr[0]);
document.write(arr[0]+"<br>");
document.write(arr[2]+"<br>");
document.write(arr[4]+"<br>");
var arr = ['*','##','***','&&&','****','##*'];
//显示数组长度
alert("数组的长度为"+arr.length);
//将数组内容输出,完成达到的效果。
document.write(arr[0]"<br>");
document.write(arr[0]);
document.write(arr[0]+"<br>");
document.write(arr[2]+"<br>");
document.write(arr[4]+"<br>");
indexOf方法如果满足条件则会返回字符串所在数组中的位置
filter()方法创建一个新的数组,新数组中的元素是通过检查指定数组中符合条件的所有元素,不会检测空数组,不会改变原始数组
infos.filter(function(items){
return items[items.indexOf("大一")] && items[items.indexOf("女")];
}).forEach(function(items){
document.write(items[0]+"<br/>");
})
filter()方法创建一个新的数组,新数组中的元素是通过检查指定数组中符合条件的所有元素,不会检测空数组,不会改变原始数组
infos.filter(function(items){
return items[items.indexOf("大一")] && items[items.indexOf("女")];
}).forEach(function(items){
document.write(items[0]+"<br/>");
})
//定义函数
function judge(a,b){
return a>b?a:b;
}
//函数体,判断两个整数比较的三种情况
//调用函数,实现下面两组数中,返回较大值。
document.write(" 5 和 4 的较大值是:"+judge(5,4)+"<br>");
document.write(" 6 和 3 的较大值是:"+judge(6,3) );
function judge(a,b){
return a>b?a:b;
}
//函数体,判断两个整数比较的三种情况
//调用函数,实现下面两组数中,返回较大值。
document.write(" 5 和 4 的较大值是:"+judge(5,4)+"<br>");
document.write(" 6 和 3 的较大值是:"+judge(6,3) );
document.write( mystr.substring(mystr.indexOf("W"),mystr.indexOf("!"))+ "<br />");
document.write( mystr.substring(mystr.indexOf("H"),mystr.indexOf("o") );
document.write( mystr.substring(mystr.indexOf("H"),mystr.indexOf("o") );
2019-07-17
var otest = document.getElementById("test");
var b = document.getElementsByTagName("li")[1];
var a = document.createElement("li");
a.innerHTML="php";
otest.insertBefore(a,b);
var b = document.getElementsByTagName("li")[1];
var a = document.createElement("li");
a.innerHTML="php";
otest.insertBefore(a,b);
2019-07-13
function checkone(){
var j=document.getElementById("wb").value;
for(var i=1;i<7;i++){
var a=document.getElementById("hobby"+i);
if(j==i){
a.checked=true;
}else{
continue;
}
}
var j=document.getElementById("wb").value;
for(var i=1;i<7;i++){
var a=document.getElementById("hobby"+i);
if(j==i){
a.checked=true;
}else{
continue;
}
}