首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

javascript特征概念

2012-10-07 
javascript特性概念加载:使页面从新加载一遍:window.location.hrefwindow.location.href求随机数:parseI

javascript特性概念
加载:

使页面从新加载一遍:window.location.href=window.location.href;


求随机数:parseInt(Math.random()*10

求随机数之和:parseInt(Math.random()*10)+parseInt(Math.random()*10);


获取当前时间:var Data =new Date();date.getTime();

假如做10道题求10道题用了多少时间:var total1;
var totaltime;var dom1=0;计数器

开始 点击按钮var date =new Date(); total1=date.getTime();
道题结束:var a = new Date();totaltime=a.getTime();
dom1=Math.round((totaltime-total1)/1000);

alert("恭喜通过将从新开始");


帮助按钮点击后隐藏:

//帮助按钮的
function write(){
if(confirm("温馨提示:方案一:30秒时间到或答对10道题才会结束,方案二:只要错误就结束游戏")){
document.getElementById('numBtn11').style.display='none'

}else{
document.getElementById('numBtn11').style.display='none'
}

}  

其次总结一下:

无论你xul 里面写 button 写vbox  box window 他们都有id  通过id 来写css  js 可以通过id 来获取模块的信息 ,例如 document.getElementByid(“id名字”).value值


如果像获取里面某元素  也可以这样 document.getElementById(“id名字”).value=finld.label;这句话就是获取lable的值。

接下来看你需要什么了,如果你需要控制输入框,就document.getElementById(“id名字”).value=finlde.label;

等等。

热点排行