常用js

js不常用但实用的JavaScript超级技巧 JavaScript 是一种应用场景多且功能强大的语言,对于现代 Web 开发至关重要。以下是一些超级技巧,它们将帮助你成为更高效、更有效的 JavaScript 开发人员,每个技巧都有详细的解释和示例。提示:以下是本篇文章正文内容,下面案例可供参考。 阅读详情
<%@page language="java" contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@include file="../../../common/dqdp_common.jsp" %>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>幸运大转盘</title>
    <link href="${baseURL}/jsp/h5/themes/css/base.css" rel="stylesheet" type="text/css"/>
    <link href="${baseURL}/jsp/h5/themes/css/index.css" rel="stylesheet" type="text/css"/>
    <script src="${baseURL}/jsp/h5/themes/js/adaptive-version3.js" type="text/javascript"></script>
    <script src="${baseURL}/jsp/h5/themes/js/jquery.min.js" type="text/javascript"></script>
    <script src="${baseURL}/jsp/h5/themes/js/main.js" type="text/javascript"></script>
	<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script type="text/javascript">
	window['adaptive'].desinWidth = 640;
    window['adaptive'].baseFont = 18;
    window['adaptive'].maxWidth = 640;
    window['adaptive'].init();
    </script>
</head>
<style type="text/css">
.rMain{
    width: 6rem;
    background:#FFF;
    border-radius: 0.1rem;
    border: 0.04rem solid #fcc802;
}
.rBox{
    padding: 0.32rem 0.26rem 0.22rem;
}
.rBox p{
    font-size: 0.28rem;
    color: #333333;
    line-height: 0.38rem;
}
.iCtrl{
    text-align: center;
    font-size: 0;
    padding: 0.1rem 0 0.38rem;
}
.iCtrl .b_btn{
    width: 3rem;
}
.userful_l li span{
	width:2rem;
}
.lqBtn {
    background: url(../themes/images/lq.png) center no-repeat;
    background-size: 100% 100%;
     width: 1.53rem;
     height: 0.53rem;
     position: absolute;
    top: 3.2rem;
    right: 1.8rem;
    z-index: 1005;
}

.lq{
    height:0.5rem;
}
.utip{
    margin-top: -0.2rem;
}
.userful_l {
    float: left;
    width: 100%;
}
</style>

<body>
	<header>
		<!--幸运大转盘<div class="fixed_app_top">
		</div>-->

			<!--<a href="javascript:history.go(-1);" class="btn_back"></a>-->

	</header>
	<!--转盘
   <!--end 转盘
    <div class="index_wrap index_wrap_z" style="background:#87d8ea url(/hyyd/uploadfile/activity/7be09986-aef4-4703-98d3-d1c734553cf4.jpg) center no-repeat;background-size:100% 100%;overflow-x: hidden;margin-top:-0.2rem;">
      <section>
         <div class="game_wrap" style="margin-top: 1.45rem;"><div class="rotate_wrap"><div id="outercont"><div id="outer-cont"  style="padding-top:0.8rem" >
                        <div id="outer" class="rotate_main" style="margin: 0 auto;background: url(/hyyd/uploadfile/activity/61fb4352-8c46-4a73-9203-74f858cc5af8.gif) center no-repeat;background-size:100% 100%;width: 4.95rem;height: 5.0rem;margin-bottom: -0.8rem;">

                        </div>
						<div id="inner" class="beginPlay"></div></div></div></div><div class="gema_info"><div class="iCtrl"><a href="javascript:getMyPrize();" class="myAward">我的奖品</a>
                            <a href=# class="dtBtn">活动详情</a>
                        </div></div></div></section></div>
    </div>-->
	<div class="dzp"> </div>

     <!--loading-->
    <div class="app_loading hideObj">
    	 <img src="${baseURL}/jsp/h5/themes/images/loading.gif"/>
    	 <b>加载中...</b>
    </div>

    <!--透明背景-->
    <div class="opacityDiv hideObj"></div>

    <!--分享弹窗-->
    <div class="popBox popBox_f1 hideObj">
    	<a href="javascript:;" class="closeBtn"></a>
    	<h3 class="share_title">分享给周围的小伙伴吧</h3>
    	<div class="share_wrap">
    		<a href="#"><img src="${baseURL}/jsp/h5/themes/images/ico_qq.png" alt="qq"/></a>
    		<a href="#"><img src="${baseURL}/jsp/h5/themes/images/ico_wx.png" alt="微信"/></a>
    		<a href="#"><img src="${baseURL}/jsp/h5/themes/images/ico_group.png" alt="朋友圈"/></a>
    		<a href="#"><img src="${baseURL}/jsp/h5/themes/images/ico_wb.png" alt="微博"/></a>
    	</div>
    </div>

	<div class="popupBg" id="popupBg1"></div>
	<div class="popup" id="popup3" style="display:none;">
     	<div class="tipsBox">
     		<p><span id="confirm"></span></p>
       	</div>
       	<div class="ctrl">
       		<ul class="halfBar">
       			<li><a href="javascript:showPopup4();" class="cBtn" id="showPopup4">放弃领取</a></li>
				<li><a href="javascript:confirm('0');" class="sBtn" id="receiveBtn">确认领取</a></li>
 			</ul>
		</div>
	</div>

	<div class="popup" id="popup4" style="display:none;">
     	<div class="tipsBox">
     		<p><span>放弃领取视频包奖品后将不会再次抽中视频包,请再次确认是否放弃。</span></p>
       	</div>
       	<div class="ctrl">
       		<ul class="halfBar">
			    <li><a href="javascript:confirm('1');" class="sBtn" id="giveupBtn">确认</a></li>
       			<li><a href="javascript:hidePopup4();" class="cBtn" id="hidePopup4">取消</a></li>
 			</ul>
		</div>
	</div>
     <!--兑换弹窗-->
    <div class="popBox popBox_user hideObj">
    	<a href="javascript:;" class="closeBtn"></a>
    	<h3 class="share_title">您获得的奖品</h3>
    	<div class="userful">
    		<div class="userful_l">
    			<nav>
    				<ul id="showMyPrize">
    					<li class="active">
    						<i><input type="radio" name="" id="" value="1" class="form_radio"/></i>
    						<p id="showPrize"></p>
    					</li>
    				</ul>
    			</nav>
    		</div>
    		<!--
    		<div class="userful_r">

    			<a href="javascript:;" class="btn_dh">兑换</a>
    		</div>
    		 -->
    	</div>
    	<p class="utip"></p>
        <p class="lq"></p>
    </div>

    <!--兑换弹窗-->
		<div class="dPop hideObj">
			<a href="javascript:;" class="dClose"></a>
			<h3 class="d_title"></h3>
			<div class="dBox">
				<div class="dMain">
				</div>
			</div>
		</div>
		 <!--号码弹窗-->
    <div class="popup" id="popup5" style="display:none;">
     	<div class="tipsBox">
     		<p><span style="margin-top: -20px;">请输入密码:</span></p>
       	    <p><input type="number" placeholder="请输入密码"  style="margin-top:15px;border: 1px solid #ccc;width: 100%;padding: 10px 10px;font-size: 14px;color: #333;-webkit-appearance: none;border-radius: 10px;" id="mobile" name="mobile"></input></p>

       	</div>
       	<div class="ctrl">
       		<ul class="halfBar">
				<li style="text-align: center;height: 40px;"><a href="javascript:inputmobile();" style="margin-top: 3px;background: #0085d0;font-size: 14px;color: #fff;height: 35px;line-height: 38px;display: inline-block;text-align: center;width: 60%;border-radius: 10px;">确认</a></li>
       			<li style="text-align: center;height: 40px;"><a href="javascript:hidePopup5();" style="margin-top: 3px;background: gray;font-size: 14px;color: #fff;height: 35px;line-height: 38px;display: inline-block;text-align: center;width: 60%;border-radius: 10px;" >取消</a></li>

 			</ul>
		</div>
	</div>
	<!--二维马-->
	<div class="popup focusPop">
        <div class="rMain">
            <!-- <h3 class="t_title">活动规则</h3> -->
            <div class="rBox">
                <center><p style="color:red">长按二维码扫描关注</p></center>
                <center><img src="${baseURL}/jsp/h5/themes/images/ydgzh.jpg" style="width:80%"/></center>
                <p style="color:red"><B>1、请先关注“河源移动沟通100”微信公众号,回复“绑定”;</B></p>
                <p style="color:red"><B>2、绑定“河源移动沟通100”后需重新进入游戏页面</B></p>
            </div>
            <div class="iCtrl">
                <a href="javascript:closeFocus();" class="icon-start-play-btn mar-auto tc ver-m family-PingFang-Medium fw-semibold tcol-white fs-36">关闭</a>
            </div>
        </div>
     </div>
     <!--二维马-->
    <!--号码弹窗-->
    <input type="hidden" id="activity_Id" value=""/>
    <input type="hidden" id="activityType" value=""/>
<script type="text/javascript">

  var subscribe = "0";
		var openid = "";
		var mobile = "";
		var info = "";
		var shareopenid = "${param.shareopenid}";
		var shareUrl = "";

		if(isEmpty(shareopenid)){
			shareopenid = "";
		}
		$(function(){
          
			// window.location.href="http://wap.gd.10086.cn/weixin/bigRotaryActivity/index.jsps?activityCode=HY_Z5DZP91&branch=HY&openId=%OPEN_ID%";
			initSign();
			if(isEmpty(getCookie("userinfo_c"))){
			if(!isEmpty(shareopenid)){
				if(shareopenid.indexOf("info")>-1){
					info=shareopenid.split("?")[1].split("=")[1];
				}
				shareopenid=shareopenid.split("?")[0];

			}else{
				info = "${param.info}";
			}
			if(isEmpty(info)){

/* 				var shareopenidCookie = getCookie("shareopenid");
				alert("shareopenidCookie_1:"+shareopenidCookie); */
				var host = window.location.host;
	        	var redirectUrl = "";
	        if(isEmpty(shareopenid)){
                    redirectUrl = "http://"+host+"${baseURL}/jsp/h5/activity/dzp/activity_lottery.jsp";
                }else{
                    redirectUrl = "http://"+host+"${baseURL}/jsp/h5/activity/dzp/activity_lottery.jsp?shareopenid="+shareopenid+"";
                }
                window.location.href="http://10086.hygmcc.net/hyyd/wx/wechat!toAuthorize.action?redirectUrl="+redirectUrl;
			}else{
				getOpenidAndPhone(info,shareopenid);
			}
			}else{
				var userinfo = getCookie("userinfo_c");
        		openid = userinfo.split("&")[1].split("=")[1];
        		mobile = userinfo.split("&")[0].split("=")[1];
				subscribe=userinfo.split("&")[2].split("=")[1];
        		if(isEmpty(shareopenid)){

        		}else{
        		   shareopenid=shareopenid.split("?")[0];
        		}

				shareUrl = "http://10086.hygmcc.net/hyyd/jsp/h5/activity/dzp/activity_lottery.jsp?shareopenid="+openid;

				if(subscribe=="1"){
                if(isEmpty(mobile) || mobile == "phone") {
                window.location="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx124bf5735423440b&redirect_uri=https://wap.gd.10086.cn/weixin/subBind/newbind.jsps?appCode=HY&response_type=code&scope=snsapi_base&state=HY#wechat_redirect";
                return;
                }else{
                        //alert(subscribe);
                        //setCookie("userinfo_c",userinfo);
						showpop();
                       // initactivity();
                        return;
                    }

			 }else{
                //alert(subscribe);
                window.location.href="http://10086.hygmcc.net/hyyd/jsp/h5/activity2/gz.jsp"
                return;
            }

		}
			//alert('游戏活动已结束');
		});

		//判断是否为空
		function isEmpty(message){
			return  message=="" || message==null || message==undefined ;
	 	}
    	function getOpenidAndPhone(info,shareopenid) {

				$.ajax({
				url:"http://10086.hygmcc.net/hyydt/wx/wechat!getOpenidAndPhone.action",
		        type:"post",
		        dataType:"json",
		        data:{
		        	"info":info
		        },
		        success:function (result) {
						console.log(result);
		    		if (result.code == "0") {
		    			openid = result.data.openid;
						mobile = result.data.phone;
						shareUrl = "https://10086.hygmcc.net/hyydt/jsp/h5/activity/dzp/activity_lottery.jsp?shareopenid="+openid;
						var subscribe = result.data.subscribe;
						var nickname = result.data.nickname;
						var headimgurl = result.data.headimgurl;
						var userinfo = "mobile="+mobile+"&openid="+openid+"&subscribe="+subscribe+"&nickname="+nickname+"&headimgurl="+headimgurl;
						userinfo = userinfo + "&shareopenid="+shareopenid+"";
						if(subscribe=="1"){
						if(isEmpty(mobile) || mobile == "phone") {
						window.location="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx124bf5735423440b&redirect_uri=https://wap.gd.10086.cn/weixin/subBind/newbind.jsps?appCode=HY&response_type=code&scope=snsapi_base&state=HY#wechat_redirect";
						return;
						}else{
                        //alert(subscribe);
                        setCookie("userinfo_c",userinfo);
                        setCookie("info",info);
                        initactivity();
                        return;
                    }

					}else{
					//alert(subscribe);
					window.location.href="http://10086.hygmcc.net/hyydt/jsp/h5/activity2/gz.jsp"
					return;
					}
				    }
		        },
		        error:function () {
		        	alert("网络开小差^^");
		        }
		    });
		}
    function initSign(){
		  	$.ajax({
		  		url : 'http://10086.hygmcc.net/hyydt/wx/wechat!initSign.action',
		  		type : 'post',
		  		dataType: 'json',
		  		data:{"url":location.href.split('#')[0]},
		  		success : function(rst){
					console.log(rst)
	                if(rst.code == 0){
		  				wx.config({
		  				    appId: rst.data.jsticketinfo.appId,
		  				    timestamp: rst.data.jsticketinfo.timestamp,
		  				    nonceStr: rst.data.jsticketinfo.nonceStr,
		  				    signature: rst.data.jsticketinfo.signature,
		  				    jsApiList: [ 'checkJsApi','onMenuShareAppMessage', 'onMenuShareTimeline', 'hideMenuItems', 'hideOptionMenu']
		  				});
		  			}
		  		},
		  		error : function(error){
					console.log(error)
		  		}
		  	});
		  }
		  	wx.ready(function(){
			wx.hideMenuItems({
			  	    menuList: ['menuItem:share:qq','menuItem:share:weiboApp','menuItem:share:facebook','menuItem:share:QZone','menuItem:copyUrl','menuItem:openWithQQBrowser','menuItem:openWithSafari']
			  	});
			  	wx.onMenuShareAppMessage({
			  		title: '周五幸运大转盘',
			  	    link: shareUrl,
			  	  	desc: '百万话费+数万G流量等你瓜分!',
			  	    imgUrl: 'http://10086.hygmcc.net/hyydt/jsp/h5/themes/images/share.jpg',
			  	    success: function () {
			  	    },
			  	    cancel: function () {
			  	    }
			  	});
			  	wx.onMenuShareTimeline({
			  		title: '周五幸运大转盘',
			  	    link: shareUrl,
			  	    desc: '百万话费+数万G流量等你瓜分!',
			  	    imgUrl: 'http://10086.hygmcc.net/hyydt/jsp/h5/themes/images/share.jpg',
			  	    success: function () {
			  	    },
			  	    cancel: function () {
			  	    }
			  	});
		});
  function showfocus(){
		$('.popupBg, .focusPop').show();
	}
	var unclaimedPrize = "";
	var prizeName="";
	var prizeCode="";
	var activityId="";
   function initactivity()
   {
    //获取大转盘详细信息
    $.ajax({
        url:'${baseURL}/h5/activity/ActivityAction!getLottery.action',
        type:'post',
        dataType:'json',
        data:{},
        success:function(data){
			var activityInfo = data.data.activityInfoVO;
			//$("#activityId").val(activityInfo.id);
		    activityId=activityInfo.id;
            $("#activityType").val(activityInfo.type);
            $(".dMain").html(activityInfo.duringCfg);
			$("#prizeInfo").attr("src","img/jp.jpg");
            var dzphtml="";
            dzphtml='<div class="index_wrap index_wrap_z" style="background:#87d8ea url(img/7be09986-aef4-4703-98d3-d1c734553cf4.jpg)';
            dzphtml+='center no-repeat;background-size:100% 100%;overflow-x: hidden;margin-top:-0.2rem;"><section>';
            dzphtml+='<div class="game_wrap" style="margin-top: 1.45rem;">';
            dzphtml+='<div class="rotate_wrap">';
            dzphtml+='<div id="outercont">';
            dzphtml+='<div id="outer-cont"  style="padding-top:0.8rem" >';
            dzphtml+='<div id="outer" class="rotate_main" style="margin: 0 auto;background: url(img/dzp.gif)';
            dzphtml+='center no-repeat;background-size:100% 100%;width: 4.95rem;height: 5.0rem;margin-bottom: -0.8rem;">';
            dzphtml+='</div><div id="inner" class="beginPlay"></div></div></div></div><div class="gema_info"><div class="iCtrl"><a href="javascript:getMyPrize();" class="myAward">我的奖品</a>';
            dzphtml+='<a href="javascript:getactivity();" class="dtBtn">活动详情</a>';
            dzphtml+='</div></div></div></section></div>';
		    $(".dzp").append(dzphtml);
		    initLottery(activityId);
            //inputmobile();

        },
        error:function(data){

        }
    });
}
	function getactivity(){
	//活动详情弹窗
	$('.dtBtn').on('click', function() {
		$('.opacityDiv,.dPop').show();
		$('.dPop').addClass('bounceIn');
	});

	}

    //跳转至我的奖品
    function getMyPrize(){
    	//activityId=$("#activityId").val();
    	if(null==activityId||"activityId"==activityId||""==activityId||"undefined"==activityId){
    		alert("获取活动信息失败!");
    		return;
    	}

		info =  getCookie("info");
		console.log(activityId)
    	window.location="${baseURL}/jsp/h5/activity/dzp/activity_myprize.jsp?info="+info+"&activityId="+activityId;

    }

	//游戏转盘
	//$(function() {
		//activityId=$("#activityId").val();
	//	initLottery(activityId);   //初始化大转盘
	//});

	function handleName(name){
		if(null!=name&&""!=name&&"undefined"!=name){
			if(4==name.length){
				return name.substring(0,2)+"</br>"+name.substring(2,name.length);
			}else if(5==name.length){
				return name.substring(0,3)+"</br>"+name.substring(3,name.length);
			}else if(6==name.length){
				return name.substring(0,4)+"</br>"+name.substring(4,name.length);
			}else if(7==name.length){
				return name.substring(0,4)+"</br>"+name.substring(4,name.length);
			}else if(8==name.length){
				return name.substring(0,4)+"</br>"+name.substring(4,name.length);
			}else{
				return name;
			}
		}
	}

	//初始化大转盘
	function initLottery(activityId){
		window.requestAnimFrame = (function() {
	        return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
	            window.setTimeout(callback, 1000 / 60)
	        }
	    })();
	    var totalDeg = 360 * 3 + 0;
	    var steps = [];
	    var sncode;
	    var now = 0;
	    var a = 0.01;
	    var outter, inner, timer, running = false;
	    //设置旋转次数与角度
	    function countSteps() {
	        var t = Math.sqrt(2 * totalDeg / a);
	        var v = a * t;
	        for (var i = 0; i < t; i++) {
	            steps.push((2 * v * i - a * i * i) /2)
	        }
	        //console.info(totalDeg);
	        steps.push(totalDeg)
	    }
	    function step() {
	        outter.style.webkitTransform = 'rotate(' + steps[now++] + 'deg)';  //控制图片旋转
	        outter.style.MozTransform = 'rotate(' + steps[now++] + 'deg)';
	        if (now < steps.length) {  //旋转中
	            requestAnimFrame(step)
	        } else {//旋转结束
	            //running = false;
	        }
	    }

	    function start(deg) {

	        clearInterval(timer);
	        totalDeg = 360 * 3 + deg;  //旋转角度
	        steps = [];
	        now = 0;
	        countSteps();
	        requestAnimFrame(step)
	    }
	    var i=1;
	    window.start = start;
	    outter = document.getElementById('outer');
	    inner = document.getElementById('inner');
		$(".beginPlay").click(function() {
			//location.reload(false);  7  17
            if(time_range ("6:59", "23:59")&&week(" 5")){
	        if (running){
	        	return;
	        }
	        $('.app_loading,.opacityDiv').show();
	        running = true;
		info = getCookie("info");
	        $.ajax({
	    		url:'${baseURL}/h5/activity/ActivityAction!getLotteryResult.action',
	    		datatype:'json',
	    		data:{"activityId":activityId,"info":info},
	    		type:'post',
	    		success:function(data){
	    			 $('.app_loading,.opacityDiv').hide();
	                 //alert(data);
					 console.log(data);
	                 //var data=JSON.parse(data);
	                 if("0"==data.code){

	                	 var tp=data.data.tp;
	                	 if(null!=tp&&"null"!=tp){
			                 prizeName=tp.prizeName;
			                 prizeCode=tp.prizeCode;
			                 //console.info(tp.prizeLocation+"--"+prizeName);
			                 start(tp.prizeLocation);  //开始旋转
			                 var intervalId = setInterval(function() {  //5秒后转盘旋转完毕
			                	 if("1"==tp.groupType){
									 if(i==1){
										 alert("不要灰心,你还有次机会。");
										 i++;
									 }else{
										 alert("谢谢参与!");
									     i=1;
									 }
			                	 }else{
									 i=1;
					                 //展示中奖信息
					                 var showPage="";
					                 showPage+='<li class="active">';
					                 showPage+='<i><input type="radio" name="" id="" value="1" class="form_radio"/></i>';
					                 showPage+='<span id="showPrize" >'+prizeName+'</span>';

					                 	 $(".utip").html(tp.prizeHint);
                                          $(".lq").html('<a href="javascript:getlq();" class="lqBtn" ></a>');
					                 	 showPage+='</li>';
						                 $("#showMyPrize").html(showPage);
						                 $(".opacityDiv,.popBox_user").show();
						                 $('.popBox_user').addClass('bounceIn');

			                	 }

			                 	 running = false;  //恢复按钮
			                 	 clearInterval(intervalId);
			                 },5000);
	                	 }else{
		                	 alert("亲活动太火爆了,请稍后再试!");
		                	 running = false;  //恢复按钮
		                 }
	                 }else{
	                	 alert(data.desc);
	                	 running = false;  //恢复按钮
	                 }
	    		},error:function(msg){
	                alert("亲活动太火爆了,请稍后再试!");
	                $('.app_loading,.opacityDiv').hide();
	                running = false;
	    		}
	    	});

			}else{
				 //console.log(time_range ("9:00", "24:00")&&week("5"))
				 alert("请前往公众号<河源移动沟通100>点击我要优惠周五幸运大转盘进行抽奖。");
			}
	    })

	}

	$('.userful_l').on('click','li',function(){
  	    var _el=$(this);
  	    _el.addClass('active').siblings().removeClass('active');
    });

   //分享弹窗
	$('.shareGame').on('click',function(){
		$('.opacityDiv,.popBox_f1').show();
		$('.popBox_f1').addClass('bounceIn');
	});
	//隐藏分享弹窗
	$('.closeBtn').on('click',function(){
		$('.opacityDiv,.popBox').hide();
		$('.popBox').removeClass('bounceIn');
	})

	//隐藏活动详情弹窗
	$('.dClose').on('click', function() {
		$('.opacityDiv,.dPop').hide();
		$('.dPop').removeClass('bounceIn');
	})
	function showpop(){
         $('#popup5,#popupBg1').show();
	}
	function hidePopup3(){
       	$('#popup3,#popupBg1').hide();
    }

	function hidePopup4(){
		$('#popup4').hide();
		$('#popup3').show();
	}

	function hidePopup5(){
		$('#popup5,#popupBg1').hide();
		$("#mobile").val(" ");
		console.log($("#mobile").val());
	}
	function showPopup4(){
       	$('#popup3').hide();
		$('#popup4').show();
	}

	function confirm(isGiveup){
		$('#giveupBtn').attr("href", "#");
		$('#receiveBtn').attr("href", "#");
		$('#hidePopup4').attr("href", "#");
		$('#showPopup4').attr("href", "#");
		var activityId=$("#activityId").val();
		 $.ajax({
	    	url:'${baseURL}/h5/activity/ActivityAction!confirmReceivePrize.action',
	    	datatype:'json',
	    	data:{"activityId":activityId,"unclaimedPrize":unclaimedPrize,"isGiveup":isGiveup,"prizeName":prizeName,"prizeCode":prizeCode},
	    	type:'post',
			async:false,
	   		success:function(data){
				var data=JSON.parse(data);
				if(data.desc!=null){
					alert(data.desc)
		   			$('#popup3,#popupBg1').hide();
				}else{
		   			$('#popup4,#popupBg1').hide();
				}
	   		},
	   		error:function(msg){
				alert("领取失败")
	   			$('#popup3,#popupBg1').hide();
    		}
    	});
		$('#giveupBtn').attr("href", "javascript:confirm('1');");
		$('#receiveBtn').attr("href", "javascript:confirm('0');");
		$('#hidePopup4').attr("href", "javascript:hidePopup4();");
		$('#showPopup4').attr("href", "javascript:showPopup4();");
	}

	function adview(){
		var activityId=$("#activityId").val();
		 $.ajax({
	    	url:'${baseURL}/h5/activity/ActivityAction!adNumber.action',
	    	datatype:'json',
	    	data:{"activityId":activityId},
	    	type:'post',
	   		success:function(data){
				window.location="http://lnyph5.vpclub.cn/lnyp/templates/cities/home/home.html?areaActId=794&areaJgid=287491";
	   		},
	   		error:function(msg){

				    		}
    	});

	}


 window.alert = function (message) {
    try {
        var iframe = document.createElement("IFRAME");
        iframe.style.display = "none";
        iframe.setAttribute("src", 'data:text/plain,');
        document.documentElement.appendChild(iframe);
        var alertFrame = window.frames[0];
        var iwindow = alertFrame.window;
        if (iwindow == undefined) {
            iwindow = alertFrame.contentWindow;
        }
        iwindow.alert(message);
        iframe.parentNode.removeChild(iframe);
    }
    catch (exc) {
        return wAlert(message);
    }
}

  function isPoneAvailable(str) {
            var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
            if (!myreg.test(str)) {
                return false;
            } else {
                return true;
            }
        }
		//取cookies函数
		function getCookie(name){
		 	var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
		 	if (arr != null) return unescape(arr[2]); return null;
		}
		//两个参数,一个是cookie的名子,一个是值
		function setCookie(name,value){
		 	var Days = 1;//此 cookie 将被保存 1 天
		 	var exp = new Date();//new Date("December 31, 9998");
		 	exp.setTime(exp.getTime() + 30*60*1000);
		 	document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
		}

		// 删除cookies
		function delCookie(name){
			var exp = new Date();
			exp.setTime(exp.getTime() - 1);
			var cval=getCookie(name);
			if(cval!=null)
				document.cookie= name + "="+cval+";expires="+exp.toGMTString();
		}
		function activityEnd(){
            alert('游戏活动已结束');
        }
		function week(day){
              if("7123456".charAt(new Date().getDay())==day){
			  return true;
			  }else{
			  return  false;
			  }
        }
		var time_range = function (beginTime, endTime) {
		var strb = beginTime.split (":");
		if (strb.length != 2) {
		return false;
		}

		var stre = endTime.split (":");
		if (stre.length != 2) {
		return false;
		}

		var b = new Date ();
		var e = new Date ();
		var n = new Date ();

		b.setHours (strb[0]);
		b.setMinutes (strb[1]);
		e.setHours (stre[0]);
		e.setMinutes (stre[1]);

		if (n.getTime () - b.getTime () > 0 && n.getTime () - e.getTime () < 0) {
		return true;
		} else {
		return false;
		}
		}

        function getlq(){
            window.location="http://lnyph5.vpclub.cn/lnyp/templates/lnypMall/flashSale.html?fsId=2310&fromMall=1&fsType=4&channelcode=HYDZP";
        }

		function inputmobile(){
			var mobile=$("#mobile").val();
			if(mobile=="123456"){
				initactivity();
				hidePopup5();
			}else{
				alert("密码错误!!!请前往服务厅办理.");
				//hidePopup5();
			}
           
        }


</script>
</body>
</html>

 

javascript JS 项目 实战 常用 特殊符号 项目 实战 常用 特殊符号 阅读详情

相关推荐

小程序HTTPS证书配置踩坑记:为什么Android访问失败而iOS正常?

本文深入剖析了小程序开发中常见的跨平台网络问题:Android访问HTTPS接口失败而iOS正常。核心原因在于服务器(如Nginx)HTTPS证书链配置不完整,Android系统对此校验严格,而iOS相对宽松。文章提供了从问题诊断、使用在线工具检测到修复Nginx证书链配置的完整解决方案,并总结了HTTPS部署的最佳实践,帮助开发者从根本上避免此类“玄学”故障。

weixin_29207149的博客 394

Javascript之base.js原型那些事儿

转眼间我们已经学习了基本的JavaScript的基本知识,具体的我会在后面的博客中会有总结,这里我在做后面第34章的项目的时候我们是在逐步地完善一个JS文件就是base.js,我们可以看出来我们使用的一些方法进行了封装,在这里我们就不得不说一下原型了,前段时间跟李芬姐谈论原型与面向对象的时候,我们就讨论过关于原型的优点而在这个文件(我们可以看成一个类)就是使用原型的方法。         原型就

郭蕾蕾 努力的包子 6236

LLC混合滞回控制 vs 电压模/电流模:UCC25640x仿真对比与选型指南

在开关电源设计中,LLC谐振变换器的环路补偿是核心难点。传统电压模控制(VMC)和电流模控制(CMC)在LLC拓扑上存在环路增益漂移、动态响应慢等局限。混合滞回控制通过滞回比较器直接调制开关频率,并融合输出电压与谐振腔电流信息,实现了自适应环路增益和快速瞬态响应。该技术显著提升轻载效率与动态性能,适用于高密度适配器、快充及车载充电机等场景。本文基于UCC25640x系列,通过仿真对比三种控制策略,为工程选型与调试提供实践参考。

weixin_33925615的博客 334

49个常用的前端JavaScript方法整理汇总

英文 | https://medium.com/@cookbug/49-commonly-used-front-end-javascript-method-packaging-f9be18...

web前端开发 2379

基于Python的微信聊天记录分析——数据获取

本篇为“基于Python的微信聊天记录分析”第一篇,主要涉及数据获取,包括Python环境配置、WeChatMsg项目配置和运行、获取聊天记录等内容,流程简单、比较基础,后续这个系列会涉及基于Python的数据处理、统计分析、NLP技术等内容。希望和大家多多交流,共同进步!

Henryli1202的博客 1万+

1553B通信项目开发笔记(一)协议概述

最近接了个项目,需要用1553B协议通信,仅作为RT端口进行通信,控制器采用ARM 使用芯片为国产的BU61580芯片,功能和引脚和DDC的61580完全一致。

u010396127的博客 2万+

javascript基础入门教程,javascript零基础入门

一门客户端脚本语言,运行在客户端浏览器中的。每一个浏览器都有JavaScript的解析引擎,不需要编译,直接就可以被浏览器解析执行了python for语句用法。//局部变量 用let定义let 变量名 = 值;//全局变量 用var定义var 变量名 = 值;//常量定义 constconst 常量名 = 值;//整数类型var a=3;// Boolean类型var b=true;// 定义小数类型 小数和整数类型统称为number类型。

阿发狗伪原创 3247

基于Arduino与Velostat的智能鞋垫:DIY足底压力监测系统全解析

压力传感器是物联网和健康监测领域的基础元件,其核心原理是将物理压力转换为可测量的电信号。通过压阻效应,材料的电阻值随压力变化,从而实现压力感知。这项技术为低成本、定制化的健康监测方案提供了可能,尤其在运动分析和康复训练中具有重要价值。本文聚焦于利用Velostat压敏材料和Arduino平台,详细解析如何从传感器制作、信号调理到无线数据传输,构建一套完整的足底压力监测系统。文中深入探讨了传感器阵列构建、信号滤波等关键技术,并针对常见问题提供了实用的解决方案,为创客和开发者实现可穿戴健康监测设备提供了清晰的工

weixin_32818781的博客 400

100个JavaScript代码片段

实现字符串长度截取 function cutstr(str, len) { var temp; var icount = 0; var patrn = /[^\x00-\xff]/; var strre = ""; for (var i = 0; i < str.length; i++) { ...

GarfieldEr007的专栏 3088

用Scratch实现凯撒密码:图形化编程与古典密码学的趣味结合

字符编码与移位运算是计算机处理文本数据的基础原理之一,它通过将字母映射为数字实现信息转换。在密码学领域,凯撒密码作为最经典的替换密码,直观地展示了基于规则字符替换的加密思想,其核心价值在于通过简单算法揭示加密解密的基本框架。这种原理在编程教育中尤为重要,能够帮助初学者理解循环、变量和字符串处理等核心概念。结合Scratch图形化编程环境,学习者可以通过拖拽积木可视化构建加密算法,将抽象的移位操作转化为交互式游戏。本项目以凯撒密码为例,通过实时密钥调整和动态字母表映射,生动演示加密过程,并自然融入暴力破解和密

weixin_32428571的博客 310

uniapp微信小程序开发:解决Video播放m3u8视频流非卡顿问题,使用video视频标签播放M3U8视频流或直播流总是加载一卡一卡的体验非常差的情况【多种优化方案提升流畅度和缓冲方案示例源码】

uniapp微信小程序video播放m3u8视频流卡,uniapp video在微信小程序播放m3u8格式视频总是加载频繁卡顿,Uniapp微信小程序苹果ios真机播放m3u8很卡加载不流畅怎么办,uni-App如何解决小程序端video播放视频流M3U8格式出现卡顿情况,uniapp播放m3u8直播流卡顿如何优化?uniapp m3u8格式视频加载,.m3u8监控视频,uniapp微信小程序使用video组件播放M3U8视频卡顿,uniapp微信小程序视频播放卡顿如何解决,uniapp 打包微信小程序播放

✅ 精选推荐文章 2987

常用或可用的js库

常用方法和函数库 lodash 日期和时间处理: monentjs dayjs html截图 html2canvas 图片裁剪 cropperjs 生成二维码 qrcodejs2 富文本编辑器 ueditor wangeditor 数据可视化 echart highChart 支持嵌套的querystring解析器 qs 流程图/关系图/组织结构图: gojs(收费) Orgchart .........

weixin_44708870的博客 1088

最新Python爬虫实战(入门爬虫篇)——案例1:某瓣网站Top250图片数据采集(附上完整爬虫代码)

本次案例通过Python爬虫技术实现了某瓣Top250电影封面的批量下载。代码采用模块化设计,函数实现cookies的自动解析,简化了配置流程,涵盖请求、解析、存储的完整流程。学习重点包括:抓包工具定位数据源、正则表达式匹配图片链接、模拟请求头绕过反爬机制、以及自动化文件管理。需要注意控制请求频率并遵守网站使用规范,适用于入门爬虫实践。

努力让自己发光,对的人才能迎着光而来 16万+

Day.js 常用方法

Day.js 轻量级日期处理库使用指南 Day.js 是一个轻量级(仅2KB)的日期处理库,可作为Moment.js的替代方案。它提供简洁的API进行日期/时间操作,包括格式化、计算、比较等常用功能。核心特性包括:格式化日期/时间(YYYY-MM-DD HH:mm:ss)、日期加减运算(add/subtract)、获取特定时间点(startOf/endOf)、日期比较(isAfter/isBefore/isSame)以及毫秒转换等。Day.js支持插件扩展,如isBetween等高级功能,文档清晰易用,适合

ZhouXin_0819的博客 243

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

js常用函数_javascript 常用的工具函数-js篇(1)

1.判断参数是否是其中之一export function oneOf (value, validList) { for (let i = 0; i < validList.length; i++) { if (value === validList[i]) { return true; } } return fa...

weixin_39561673的博客 139

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

JavaScript 常用库

JavaScript 的常用库为开发者提供了丰富的功能选择,无论是前端 UI 框架、后端服务开发,还是工具库的使用,都能大大提升开发效率。在实际开发中,选择合适的库需要根据项目需求、性能要求以及团队熟悉度综合考虑。通过灵活使用这些常用库,开发者可以更高效地构建现代 Web 应用。

Flying_Fish_roe的博客 1796

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

javascript framework js常用框架

js常用框架 一.node.js 二.angularjs.js 三.react.js 四.webpack.js 五.flux.js 六.vue.js 七.bootstrap 转载于:https://www.cnblogs.com/zlp520/p/5809442.html...

dazhexuan0219的博客 227

常用js(javascript)函数

 常用js(javascript)函数  1.常规函数  javascript常规函数包括以下9个函数:  (1)alert函数:显示一个警告对话框,包括一个OK按钮。  (2)confirm函数:显示一个确认对话框,包括OK、Cancel按钮。  (3)escape函数:将字符转换成Unicode码。  (4)eval函数:计算表达式的结果。  (5)isNaN函数:测试是(true)否(f

winderain的专栏 2030

【JavaScript】Js中一些数组常用API总结

Js中数组是一个重要的数据结构,它相比于字符串有更多的方法,在一些算法题中我们经常需要将字符串转化为数组,使用数组里面的API进行操作。本篇文章总结了一些数组中常用的API,我们把它们分成两类,一类是会改变原始数组,一类是不会改变原始数组;一起来看一下吧。

2301_79456272的博客 885

JavaScript常用前端框架和库浅谈_前端框架设计-js

以上这些JavaScript库都是前端开发中常用的工具,它们提供了丰富的功能以及易于使用的API接口,使得开发人员可以更轻松地处理常见的任务和增加网页的交互性。在现代的前端开发中,掌握流行的前端框架和库是非常重要的。本文将介绍一些常用的JavaScript前端框架和库,包括React、Angular和Vue.js,并深入了解它们的核心概念、使用方法和最佳实践。除了前端框架之外,JavaScript库也是前端开发中常用的工具。以上是这些库的基本使用方法,更详细的使用可以查阅官方文档或相关教程。

2401_89690362的博客 957

Javascript基础——不常用但很有用的js函数

1.1. JavaScript函数 这部分对Extjs中常用的几个JavaScript参数和函数进行说明,它们是arguments、call、apply、caller、callee。这几个函数在普通的JavaScript编程中很少使用,但在Extjs的源码中却经常会碰到,所以先熟悉这几个函数对Extjs的学习有很大的帮助。 1.1.1. arguments arguments是JavaScript函数的隐含对象,它代表正在执行的函数和调用该函数时传入的参数。arguments中存储的是调用该函数时实际

weoln的专栏 1181

js常用函数_JavaScript中常用的输入输出函数

作为刚踏进js大门的新手,首先必须掌握js中有哪些常用的输入输出函数,下面我为大家介绍我们常用的4种输入输出函数,警告窗函数alert(),输出函数document.write(),提示对话函数prompt(),confirm()函数。1. 警告窗函数alert(“要输出的信息”)此函数只有一个参数,参数可以是字符串、变量或者表达式。如下:(1) alert(“你喜欢JavaScript吗”);(...

weixin_39907316的博客 1346

JS常用函数

js常用的内置方法和函数 JavaScript常用函数以及语法 JS系统内置函数

Hanyinh的博客 305

JavaScript学习总结(9)——JS常用函数(一)

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34413357的博客 158

javascript数组常用方法(js数组常用方法)

js数组常用方法整理 Array.push()   向数组的末尾添加一个或多个元素,并返回新的数组长度。原数组改变。 let arr = [1,2,3] arr.push(4,5,6) console.log('arr.push',arr) // [1,2,3,4,5,6] Array.pop()   删除并返回数组的最后一个元素,若该数组为空,则返回undefined。原数组改变。 let arr = [1,2,3,4,5,6] let del = arr.pop() consol

家有呆喵~的博客 313
上一篇: SSM框架相关基础面试题整理
下一篇: spring boot 2.0 源码分析(一)
八点二十四分
博客等级 码龄10年 29粉丝 291原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值