var questionList = new Array( ["1.你的星座是什么?", [["A.巨蟹", 4], ["B.白羊", 2], ["C.天蝎", 3], ["D.其他", 1]]], ["2.你的专业是哪类?", [["A.文科", 4], ["B.理科", 3], ["C.工科", 2], ["D.其他", 1]]], ["3.“我就和你嘿嘿嘿”出自谁?", [["A.山下智博", 2], ["B.费玉清", 4], ["C.周杰伦", 0], ["D.小s ", 0]]], ["4.你喜欢下列哪种动物?", [["A.狗", 2], ["B.猫", 3], ["C.鲸", 4], ["D.户", 1]]], ["5.绅士是什么意思?", [["A.大叔", 0], ["B.宅男", 0], ["C.举止优雅的上层人士", 0], ["D.变态", 4]]], ["6.你的大学名字里带哪个字?", [["A.工", 3], ["B.南", 2], ["C.文", 4], ["D.其他", 1]]], ["7.女人有几张嘴?", [["A.一张", 1], ["B.2张", 3], ["C.4张", 4], ["D.浑身都是嘴", 2]]], ["8.你最喜欢下列哪个颜色?", [["A.粉色", 4], ["B.白色", 3], ["C.蓝色", 1], ["D.黑色", 2]]], ["9.你喜欢什么样的女孩?", [["A.黑长直", 2], ["B.大波浪的长头发", 4], ["C.俏皮可爱的中长发 ", 1], ["D.中性风短发", 1]]] ); var ratioList = new Array( [7,1], [8,5], [9,10], [10,17], [11,21], [12,25], [13,30], [14,35], [15,37], [16,41], [17,46], [18,50], [19,54], [20,58], [21,60], [22,63], [23,66], [24,69], [25,72], [26,75], [27,77], [28,80], [29,83], [30,85], [31,87], [32,90], [33,92], [34,95], [35,98], [36,99] ); var scoresSum = 0; $(function () { $("#btn_start").click(function () { $(".page_1").hide(); $(".page_2").show(); ShowQuestion(0, 0); }); }); function ShowQuestion(index, scores) { scoresSum = (scoresSum - -scores); if (index >= questionList.length) { //答题完成 $(".page_2").hide(); $(".page_3").show(); var introStr = ""; var tipStr = ""; var ratioStr = 0; for (var i = 0; i < ratioList.length; i++) { if (ratioList[i][0] == scoresSum) { ratioStr = ratioList[i][1]; break; } } if (scoresSum >= 32) { tipStr = "污中王中王"; introStr = "你的污值击败了 " + ratioStr + "%的大学僧,经鉴定你是污中王中王!“黄上”最佳代言人,出口成污,自带黄段子光环,站在污力巅峰独孤求败。"; } if (scoresSum >= 27 && scoresSum <= 31) { tipStr = "超级大污王"; introStr = "你的污值击败了 " + ratioStr + "%的大学僧, 经鉴定你是超级大污王!行走的黄段子字典,常年占据污力界元老地位无人能及,污力滔滔也只能望尘莫及。"; } if (scoresSum >= 21 && scoresSum <= 26) { tipStr = "污大王"; introStr = "你的污值击败了 " + ratioStr + "%的大学僧, 经鉴定你是污大王!黄段子力max,污力界护法战斗力爆表,再修炼一番,你就是下一届的污中王中王!"; } if (scoresSum >= 16 && scoresSum <= 20) { tipStr = "小黄人"; introStr = "你的污值击败了 " + ratioStr + "%的大学僧, 经鉴定你是小黄人!既能和污力界高手无障碍交流,又能保持自己的节操,是个游走于污力界与节操界的使者,未来的世界和平大使就靠你啦!"; } if (scoresSum >= 12 && scoresSum <= 15) { tipStr = "纯洁宝宝"; introStr = "你的污值击败了 " + ratioStr + "%的大学僧, 经鉴定你是稀有的纯洁宝宝!生活在这污力满满的世界却能抵挡住污力界的进攻,少侠的实力不可小觑!纯洁世界的未来就靠你啦!"; } if (scoresSum >= 7 && scoresSum <= 11) { tipStr = "白莲花"; introStr = "你的污值击败了 " + ratioStr + "%的大学僧,经鉴定你时世间稀有的一朵白莲花!面对污力界的浸淫,还能出淤泥而不染,让污力滔滔们见之而自行惭愧,污力世界的唯一光明,请继续照耀我们!"; } $("#result_tip").html(tipStr); $("#result_intro").html(introStr); } else { for (var i = 0; i < questionList.length; i++) { if (index == i) { //找到题目 $("#t_t_tip").html(questionList[i][0]); var answerList = questionList[i][1]; $("#t_a_l").html(""); for (var a = 0; a < answerList.length; a++) { var name = answerList[a][0]; var scor = answerList[a][1]; $("#t_a_l").append("<a href=\"javascript:ShowQuestion(" + (index - -1) + "," + scor + ")\">" + name + "</a>"); } $("#t_a_l").append("<div class=\"clear\"></div>"); } } } } function weixinAddContact(name) { WeixinJSBridge.invoke("addContact", { webtype: "1", username: name }, function (e) { //WeixinJSBridge.log(e.err_msg); alert(e.err_msg); //e.err_msg:add_contact:added 已经添加 //e.err_msg:add_contact:cancel 取消添加 //e.err_msg:add_contact:ok 添加成功 if (e.err_msg == ‘add_contact:added‘ || e.err_msg == ‘add_contact:ok‘) { alert(‘关注成功,或者已经关注过‘); } }) }