網(wǎng)站兌換碼為空?
創(chuàng)新互聯(lián)專注于網(wǎng)站建設、成都網(wǎng)站制作、網(wǎng)頁設計、網(wǎng)站制作、網(wǎng)站開發(fā)。公司秉持“客戶至上,用心服務”的宗旨,從客戶的利益和觀點出發(fā),讓客戶在網(wǎng)絡營銷中找到自己的駐足之地。尊重和關懷每一位客戶,用嚴謹?shù)膽B(tài)度對待客戶,用專業(yè)的服務創(chuàng)造價值,成為客戶值得信賴的朋友,為客戶解除后顧之憂。
換個瀏覽器試試
有可能是javascript出了點問題
chrome firefox都試試
金淘寶服務那個,里面有打折活動什么的,你購買那個就可以了設置成金額到多少就自動優(yōu)惠,或者購買那個優(yōu)惠券的,讓買家自己去領。
原因:可能是網(wǎng)絡不好,先登出去然后重新進入。
方法:
先確定是服務號,進行公眾號認證,開通微信支付,然后可以添加微信卡券,里面就可以設置會員卡了。設置會員卡需要等工作人員審核,審核通過后就可以給關注者領取,或者通過二維碼領取。如果需要更多自定義的功能,是需要進行公眾號接口開發(fā)的。
使用wechat-card module可以按照以下操作:
var card = {card_type: "DISCOUNT",base_info: {? // ...},
special_info: { // ... };
wxCard.card.createCard(card, function(err, cardId) {// 創(chuàng)建成功后,返回卡券的ID});
本文實例為大家分享了js抽獎程序的編寫代碼,以及編寫注意事項,感興趣的小伙伴們可以參考一下
代碼:
!DOCTYPE
html
html
lang="en"
head
meta
charset="UTF-8"
title簡單抽獎(可用鍵盤)/title
style
*{margin:0;padding:0;}
.box{width:
400px;height:
300px;margin:50px
auto;background:
red}
.title{color:
#fff;font-size:
30px;font-weight:700px;padding:
50px
0;text-align:
center;height:40px;}
.btm{text-align:
center;padding:20px
0;}
.btm
a{display:
inline-block;width:
120px;height:60px;line-height:
60px;background:
#FEF097;margin:0
10px;text-decoration:
none;}
/style
script
var
data=['Iphone','Ipad','筆記本','相機','謝謝參與','充值卡','購物券'],
timer=null,//定時器
flag=0;//阻止多次回車
window.onload=function(){
var
play=document.getElementById('play'),
stop=document.getElementById('stop');
//
開始抽獎
play.onclick=playFun;
stop.onclick=stopFun;
//
鍵盤事件
document.onkeyup=function(event){
event
=
event
||
window.event;
//
回車鍵的code值:13
if(event.keyCode==13){
if(flag==0){
playFun();
flag=1;
}else{
stopFun();
flag=0;
}
}
}
function
playFun(){
var
title=document.getElementById('title');
var
play=document.getElementById('play');
clearInterval(timer);
timer=setInterval(function(){
var
random=Math.floor(Math.random()*data.length);
title.innerHTML=data[random];
},60);
play.style.background='#999';
}
function
stopFun(){
clearInterval(timer);
var
play=document.getElementById('play');
play.style.background='#FEF097';
}
}
/script
/head
body
div
class="box"
div
class="title"
id="title"淘家趣抽獎/div
div
class="btm"
a
href="javascript:;"
id="play"開始/a
a
href="javascript:;"
id="stop"停止/a
/div
/div
/body
/html
注意點:
1.隨機數(shù),取數(shù)組的其中一個;取0-n之間:Math.random()*(n+1)
2.定時器,開始抽獎時要停止前面的一次抽獎,不然會定時器重疊
3.按鍵操作,要判斷是抽獎進行中,還是未開始,所有設置了變量
flag
想要學習更多關于javascript抽獎功能,請參考此專題:javascript實現(xiàn)抽獎功能
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
!DOCTYPE?html
html
head
meta?charset="utf-8"/
meta?name="format-detection"?content="telephone=no"
titletest/title
style?type="text/css"
body{text-align:?center;}
.div1{
max-width:?1000px;
margin:?50px?auto;
padding:?20px?0;
background-color:?#efa;
}
/style
/head
body
div?class="div1"試試手氣/div
button?class="btn"點擊抽獎/button
script?type="text/javascript"
window.onload=function(){
//?var?form=document.forms[0];
var?oDiv=document.querySelector(".div1");
var?oBtn=document.querySelector(".btn");
var?arr=[
{item:"美女一個",chances:20},
{item:"巴掌一個",chances:15},
{item:"嗜血珠",chances:20},
{item:"攝魂棒",chances:20},
{item:"誅仙劍",chances:25}
]; //獎項對象
//?處理數(shù)據(jù)
var?start_num=0;
for(var?i=0,len=arr.length;ilen;i++){
if(i!=0){
start_num+=arr[i-1]["chances"];
}
arr[i].range=[start_num,(start_num+arr[i]["chances"]-1)];
}
oBtn.onclick=function(){ //綁定事件
setFunc();
}
console.log(arr);
function?setFunc(){
var?num=parseInt(Math.random()*100);
for(var?j=0,len=arr.length;jlen;j++){
if(arr[j]["range"][0]=num??arr[j]["range"][1]=num){
oDiv.innerHTML="恭喜你獲得"+arr[j]["item"];
}
}
}
}
/script
/body
/html
寫了個例子,可以參考一下思路
!doctype?html
html
head
meta?charset="utf-8"
titlejquery版的網(wǎng)頁倒計時效果/title
style?type="text/css"
/style
script?src=""/script
script?type="text/javascript"
var?intDiff?=?parseInt(86400);?//倒計時總秒數(shù)量(1天=24*60*60=86400)
function?timer(intDiff)?{
window.setInterval(function()?{
var?day?=?0,
hour?=?0,
minute?=?0,
second?=?0;?//時間默認值
if(intDiff??0)?{
day?=?Math.floor(intDiff?/?(60?*?60?*?24));
hour?=?Math.floor(intDiff?/?(60?*?60))?-?(day?*?24);
minute?=?Math.floor(intDiff?/?60)?-?(day?*?24?*?60)?-?(hour?*?60);
second?=?Math.floor(intDiff)?-?(day?*?24?*?60?*?60)?-?(hour?*?60?*?60)?-?(minute?*?60);
}
if(minute?=?9)?minute?=?'0'?+?minute;
if(second?=?9)?second?=?'0'?+?second;
$('#day_show').html(day?+?"天");
$('#hour_show').html('s?id="h"/s'?+?hour?+?'時');
$('#minute_show').html('s/s'?+?minute?+?'分');
$('#second_show').html('s/s'?+?second?+?'秒');
intDiff--;
},?1000);
}
$(function()?{
timer(intDiff);
});
/script
/head
body
div?class="time-item"
span?id="day_show"0天/span
span?id="hour_show"0時/span
span?id="minute_show"0分/span
span?id="second_show"0秒/span
/div
/body
/html
form
新聞名稱:javascript券,校園網(wǎng)禁止進入JAVASCRIPT
本文路徑:http://chinadenli.net/article42/dscsoec.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、ChatGPT、動態(tài)網(wǎng)站、移動網(wǎng)站建設、服務器托管、網(wǎng)站導航
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)