Yuansheng JS creates lottery page
This time I will show you how to make a lottery page using Yuansheng JS. What are the precautions for making a lottery page using Yuansheng JS? Here is a practical case, let’s take a look.
Rendering:
Picture material:
The code is as follows, copy and use:
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>幸运抽奖页面</title> <style> /*CSS代码*/ *{ padding:0; margin:0; } .login-box{ width:500px; height:430px; /* border:1px solid red;*/ /*水平居中*/ margin:100px auto; <!-- 此处需要修改为自己的图片路径 --> background: url(img/tx1.png) no-repeat; box-shadow: 0 0 2px rgba(0,0,0,.5); } .login{ padding:5px; border:0 none; background: #0a88e1; color: white; font-size:12px; text-align: center; width:220px; line-height: 20px; margin-top:200px; margin-left:120px; } </style> </head> <body> <p class="login-box"> <input type="button" value="点击开始抽奖" class="login" id="luckbtn" onclick="luck()"/> </p> </body> <script> //JS代码:幸运抽奖 var no = prompt("请输入您的四位会员卡号:"); //获取到抽奖按钮 document.getElementById("luckbtn").value =no+"-欢迎你,点击开始抽奖" ; //当点击抽奖按钮的时候调用,幸运抽奖的规则及提醒,功能 function 函数 function luck(){ //系统随机生成一个0-10之间的随机整数 :Math.random() 0-1之间的浮点数 var num = parseInt(Math.random()*10); /*alert(num);*/ //随机数=会员卡号的百位数 /* var gewei = no%10; alert(gewei);*/ /*var shiwei = parseInt(no/10%10); alert(shiwei);*/ var baiwei = parseInt(no/100%10); /*alert(baiwei);*/ if(baiwei == num){ alert("恭喜"+no+",您中奖了!"); }else{ alert("对不起,"+no+",您没有中奖!"); } } </script> </html>
If you have a better method or more functions, you can share it with us. If there are any errors, please contact me to correct them.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Detailed explanation of computed use cases in Vue.js
How Vue uses dynamically refreshed Echarts components
The above is the detailed content of Yuansheng JS creates lottery page. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Want to copy a page in Microsoft Word and keep the formatting intact? This is a smart idea because duplicating pages in Word can be a useful time-saving technique when you want to create multiple copies of a specific document layout or format. This guide will walk you through the step-by-step process of copying pages in Word, whether you are creating a template or copying a specific page in a document. These simple instructions are designed to help you easily recreate your page without having to start from scratch. Why copy pages in Microsoft Word? There are several reasons why copying pages in Word is very beneficial: When you have a document with a specific layout or format that you want to copy. Unlike recreating the entire page from scratch

How to use WebSocket and JavaScript to implement an online speech recognition system Introduction: With the continuous development of technology, speech recognition technology has become an important part of the field of artificial intelligence. The online speech recognition system based on WebSocket and JavaScript has the characteristics of low latency, real-time and cross-platform, and has become a widely used solution. This article will introduce how to use WebSocket and JavaScript to implement an online speech recognition system.

WebSocket and JavaScript: Key technologies for realizing real-time monitoring systems Introduction: With the rapid development of Internet technology, real-time monitoring systems have been widely used in various fields. One of the key technologies to achieve real-time monitoring is the combination of WebSocket and JavaScript. This article will introduce the application of WebSocket and JavaScript in real-time monitoring systems, give code examples, and explain their implementation principles in detail. 1. WebSocket technology

Introduction to how to use JavaScript and WebSocket to implement a real-time online ordering system: With the popularity of the Internet and the advancement of technology, more and more restaurants have begun to provide online ordering services. In order to implement a real-time online ordering system, we can use JavaScript and WebSocket technology. WebSocket is a full-duplex communication protocol based on the TCP protocol, which can realize real-time two-way communication between the client and the server. In the real-time online ordering system, when the user selects dishes and places an order

In daily work, we encounter a lot of things that require drawing lots. The traditional method is to randomly draw numbers using paper numbers. With the development of electronic software, we can use computers to draw lots. The lesson I want to share with you today is How to make an excel lottery applet. 1. First, we open the Excel software and open the table we prepared. The table must contain our names. 2. Then we merge the cells on the right, fill in black who is lucky tonight, and merge the cells below and fill in red, as shown in the figure below. 3. Then we enter the randbetween function in the red area and set the first line to 2 and the last line to 7, as shown in the figure below. 4. Then we enter ind in front

Page refresh is very common in our daily network use. When we visit a web page, we sometimes encounter some problems, such as the web page not loading or displaying abnormally, etc. At this time, we usually choose to refresh the page to solve the problem, so how to refresh the page quickly? Let’s discuss the shortcut keys for page refresh. The page refresh shortcut key is a method to quickly refresh the current web page through keyboard operations. In different operating systems and browsers, the shortcut keys for page refresh may be different. Below we use the common W

How to use WebSocket and JavaScript to implement an online reservation system. In today's digital era, more and more businesses and services need to provide online reservation functions. It is crucial to implement an efficient and real-time online reservation system. This article will introduce how to use WebSocket and JavaScript to implement an online reservation system, and provide specific code examples. 1. What is WebSocket? WebSocket is a full-duplex method on a single TCP connection.

Title: Implementation method of page jump in 3 seconds: PHP Programming Guide In web development, page jump is a common operation. Generally, we use meta tags in HTML or JavaScript methods to jump to pages. However, in some specific cases, we need to perform page jumps on the server side. This article will introduce how to use PHP programming to implement a function that automatically jumps to a specified page within 3 seconds, and will also give specific code examples. The basic principle of page jump using PHP. PHP is a kind of
