六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 173|回复: 0

javascript特性概念

[复制链接]

升级  93%

145

主题

145

主题

145

主题

举人

Rank: 3Rank: 3

积分
479
 楼主| 发表于 2013-2-7 23:29:31 | 显示全部楼层 |阅读模式
加载:

使页面从新加载一遍: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;

等等。
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表