发表于: 2016-12-30 23:33:48

2 1638


今天完成的事情:任务1=。= 结束  居然看着看着 然后把一个师兄的 代码背了下来  虽然理解  感觉不是自己的  然后自己码了 4遍 都理解了

1.倒计定时器:timename=setTimeout("function();",delaytime);
2.循环定时器:timename=setInterval("function();",delaytime);
clearTimeout(对象) 清除已设置的setTimeout对象
clearInterval(对象) 清除已设置的setInterval对象

明天计划的事情;点击跳转的方法   random  array object学习这个  然后早上感觉学一点基础  中午开始码这样效率感觉会高很多

遇到的困难:很不很不熟练=。=  

收获:学会了 用F12  看自己的代码怎么运行的  

通过 JavaScript,您需要操作 HTML 元素。
为了做到这件事情,您必须首先找到该元素。有三种方法来做这件事:
通过 id 找到 HTML 元素
通过标签名找到 HTML 元素
通过类名找到 HTML 元素
var forms = document.forms; // 表单集合
var form = forms[0]; // 集合里的第一个form
var elements = form.elements; // 表单里的所有表单元素
var t = elements['t]; // 获取name属性为t的表单元素
t.checked = true; // 设置checked属性为true
1,只执行一次的定时器 
//定时器 异步运行 
function hello(){ 
alert("hello"); 
//使用方法名字执行方法 
var t1 = window.setTimeout(hello,1000); 
var t2 = window.setTimeout("hello()",3000);//使用字符串执行方法 
window.clearTimeout(t1);//去掉定时器 
</script> 
想间隔几秒自动跳转到另一个页面,则你就需要采用倒计定时器“setTimeout("function();",delaytime)”
而如果想将某一句话设置成一个一个字的出现则需要用到循环器“setInterval("function();",delaytime)”
JS中定时执行,setTimeout和setInterval的区别,以及l解除方法
setTimeout(Expression,DelayTime),在DelayTime过后,将执行一次Expression,setTimeout 运用在延迟一段时间,再进行某项操作。
setTimeout("function",time) 设置一个超时对象
setInterval(expression,delayTime),每个DelayTime,都将执行Expression.常常可用于刷新表达式.
setInterval("function",time) 设置一个超时对象
SetInterval为自动重复,setTimeout不会重复。
clearTimeout(对象) 清除已设置的setTimeout对象
clearInterval(对象) 清除已设置的setInterval对象





返回列表 返回列表
评论

    分享到