<div id="report_dialog"> <div id="report_close"><a onClick="report_dialog_close()" href="javascript:void(0)"></a></div> <h3>报错</h3> <div class="report_con"> <div class="report_types"> <a href="#" onClick="report_choice(1)">1.提示"设备上没有安装该游戏"</a> <a href="#" onClick="report_choice(2)">2.我关了游戏,退出了后台,使用存档后无效</a> <a href="#" onClick="report_choice(3)">3.iCould账号同步成功后,里面没有钱</a> <a href="#" onClick="report_choice(4)">4.Game Center账号上的存档没有钱了</a> <a href="#" onClick="report_choice(5)">5.iCould或者Game Center的密码错误</a> </div> <div class="report_input"> <textarea id="report_txt"></textarea> </div> </div> <div class="report_btn"> <a id="report_submit" onClick="report_submit()" href="javascript:void(0)">提交</a> </div> </div>
JS
//报错框相关函数 var report_type = 0; function report_dialog_show(){ var report_str = getCookie('fengzigame_report'); var id = $_GET['id']; if(report_str.search(eval("/" + id + "/g")) > 0){ alert('你已经报过错误了!'); }else{ $('#report_dialog').css('display','block'); } } function report_dialog_close(){ report_type = 0; $('#report_dialog .report_con .report_types a').removeClass('typechose'); $('#report_dialog').css('display','none'); } function report_choice(type){ var i = type-1; report_type = type; $('#report_dialog .report_con .report_types a').removeClass('typechose'); $('#report_dialog .report_con .report_types a:eq('+i+')').addClass('typechose'); } function report_submit(){ var txt = $('#report_txt').val(); if(report_type==0){ return false; } var report_str = getCookie('fengzigame_report'); var id = $_GET['id']; report_str += ','+id; setCookie('fengzigame_report',report_str,'0'); report_dialog_close(); }
JS
/*----COOKIE 相关----*/ //获取 cookie function getCookie(c_name){ if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "=") if (c_start!=-1) { c_start=c_start + c_name.length+1 c_end=document.cookie.indexOf(";",c_start) if (c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)) } } return "" } //设置cookie 第一个参数是保存的名字 第二个参数是值 第三个参数是保存的时间(单位小时)0为游览器关闭就消失 function setCookie(objName,objValue,objHours){//添加cookie var str = objName + "=" + escape(objValue); if(objHours > 0){//为0时不设定过期时间,浏览器关闭时cookie自动消失 var date = new Date(); var ms = objHours*3600*1000; date.setTime(date.getTime() + ms); str += "; expires=" + date.toGMTString(); } document.cookie = str; } //检查cookie状态 function checkLikeStatus(tagid){ var like_str = getCookie('ciwei_like') if(like_str!=null && like_str!=""){ if(like_str.search(eval("/" + tagid + "/g")) > 0){ return 'overlike_button'; }else{ return 'ilike_button'; } }else{ return 'ilike_button'; } } //删除cookie function deleteCookie(name){ var date=new Date(); date.setTime(date.getTime()-10000); document.cookie=name+"= ; expire="+date.toGMTString(); }