Sweepstakes JavaScript Program

Source: Internet
Author: User

<span style= "color: #006600;" ><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
<meta charset= "UTF-8" >
<title> Sweepstakes </title>
<meta name= "Generator" content= "editplus" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
<style>
P{color: #ff3366; font:bolder 30px Microsoft Jacob Black; text-align:center;}
. Select{width:100px;height:60px;border: #ff66ff solid 1px;background-color: #ffffff; Float:left;margin:10px;font: Bolder 22px blackbody; text-align:center;line-height:60px;}
. Row1{width:600px;height:100px;margin-right:2px;float:left;}
. Row2{width:600px;height:100px;float:left;clear:left;}
. Row3{width:600px;height:100px;margin-left:2px;float:left;clear:left;}
#button {width:228px;background-color: #ff3366; font:bolder 22px blackbody; Line-height:60px;cursor:pointer;border: #ff66ff Solid 0;}
#main {margin:100px 250px}
</style>
<script type= "text/javascript" language= "JavaScript" >
var speed=800;
var id=0;
var on=0;
function Select () {
var num=math.round (Math.random () *1000);
if (num>998) {
Alert ("Congratulations on winning the Principal award!") \ n "Deluxe Villa Set" ");//probability: 1/1000
}else if (num>990) {
Alert ("Congratulations on getting the first prize!") "Ferrari Car" ");//probability: 1/100
}else if (num>900) {
Alert ("Congratulations on your second prize!") \ n "Ten-nation European Tour");//probability: 10/100
}else if (num>800) {
Alert ("Congratulations on getting the third prize!") \ n "Ipone5");//probability: 20/100
}else if (num>600) {
Alert ("Congratulations on winning the Lucky prize!") \ n "Carnival package");//probability: 40/100
}else if (num>500) {
Alert ("Congratulations on your winning the participation Award!") \ n "Active doll Pair" ");//probability: 50/100
}else{alert ("Sorry, you didn't get any prizes!") \ n Keep up! ");} Probability: 50/100
}
Function sta () {
if (on==0) {
if (id>0)
id--;
On=1;
Start ();
}else{
Select ();
document.getElementById ("button"). innerhtml= "click the Lottery";
on=0;
}
}
function Start () {
if (on==1) {
if (id>9) {
id=id%10;
}
id++;
var Currentdiv=document.getelementbyid (ID);
document.getElementById ("button"). innerhtml= "Pause";
if (id<11) {
ChangeColor (Currentdiv, "#ff3366");
var t=settimeout ("Test (ID)", speed);
}
}
}
function ChangeColor (obj,color) {
Obj.style.backgroundcolor=color;
Obj.style.fontsize= "18px";
Obj.innerhtml= "in the lottery.";
}
function test (ID) {
if (on==1) {
var Button=document.getelementbyid (ID);
ChangeColor (Button, "#ffffff");
Button.innerhtml=id;
speed-=30;
if (speed<100) {speed=100;}
Start ();
}
}
</script>
<body>
<p> Luxury villas, Ferrari sports cars, European ten countries Tour, Ipone5 and so on you come to get! <p>
<p> don't miss the chance of a millennium! <p>
<div id= "main" class= "" >
<div id= "" class= "row1" >
<div id= "1" class= "select" >1</div>
<div id= "2" class= "select" >2</div>
<div id= "3" class= "select" >3</div>
<div id= "4" class= "select" >4</div>
</div>
<div id= "" class= "row2" >
<div id= "ten" class= "select" >10</div>
<div id= "button" class= "select" onclick= "sta ()" > click Draw </div>
<div id= "5" class= "select" >5</div>
</div>
<div id= "" class= "row3" >
<div id= "9" class= "select" >9</div>
<div id= "8" class= "select" >8</div>
<div id= "7" class= "select" >7</div>
<div id= "6" class= "select" >6</div>
</div>
</div>
</body>
</span>

Sweepstakes JavaScript Program

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.