close

1擷取.PNG

 

--------------------------------------------------------------------------------------------------------------

<html>
<meta charset = "UTF-8">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=BIG5">
<title>第一支javaScript</title>
</head>
<body>
<h2>document.write用法</h2>
 <Script type ="text/javascript">

var a,b,c, maxNum, minNum;


minNum=0;
maxNum=9;

a=Math.floor( Math.random() * (maxNum - minNum + 1) ) + minNum;
b=Math.floor( Math.random() * (maxNum - minNum + 1) ) + minNum;
c=Math.floor( Math.random() * (maxNum - minNum + 1) ) + minNum;

while(b==a){
    b=Math.floor( Math.random() * (maxNum - minNum + 1) ) + minNum;
}

while(c==a || c == b){
    c=Math.floor( Math.random() * (maxNum - minNum + 1) ) + minNum;
}


  document.write("亂數"+a+b+c);
 </Script>
</body>
</html>

arrow
arrow
    文章標籤
    程式設計工藝大師
    全站熱搜
    創作者介紹
    創作者 ~星殞~ 的頭像
    ~星殞~

    ~星殞~的部落格

    ~星殞~ 發表在 痞客邦 留言(0) 人氣()