随机称呼和随机秒数

var a,b;
//随机生成姓
var xing=Array("贾","赵","萧","梁","胡","谢","曹","袁","傅","彭","蒋","蔡","魏","薛","阎"," 潘","戴","夏","姜","姚","邹","熊","郝","秦","蒋","邵","侯","段","武","赖","龚","奥","夏侯","诸葛","上官","欧阳","尉迟","公孙","岳","墨","琴","涂","温","匡","余","余" ,"温","景","庄","王","燕","袁","景","马","伊","樊","朱","冯","雷","范","穆","麒","安"," 布","卜","白","拜","鲍","庹","崔","程","晨","迟","常","车","翟","窦","狄","费","范","郭"," 葛","恭","霍","孔","柯","骆","苗","孟","潘","乔","童","屠","邰","谭","巫","翁","徐","肖"," 萧","夏","张","李","赵","刘","杨");
//随机称呼
var xin2=Array("小姐","先生");
a=Math.floor(Math.random()*104);
b=Math.floor(Math.random()*2);
function clrTA(obj, str) {
   if (obj.value == str) {
      obj.value = "";
   }
   else{
      obj.style.color="#000";

   }
}

//显示随机的称呼

<font color="#FF0000"><script>document.write(xing[a] + xin2[b]);</script></font>

 

 

//随机数
function fRandomBy(under, over){
   switch(arguments.length){
      case 1: return parseInt(Math.random()*under+1);
      case 2: return parseInt(Math.random()*(over-under+1) + under);
      default: return 0;
   }
}

<font color="#0000FF"><script>document.write(fRandomBy(1,60));</script></font>

posted @ 2018-07-09 10:13  ALLpick  阅读(420)  评论(0编辑  收藏  举报