作者:windy2000 時(shí)間: 2004-01-18 文檔類型:原創(chuàng) 來自:藍(lán)色理想
沒什么實(shí)際用途,純屬消遣Quick Click<html> <head> <title>Quick_Click</title> <SCRIPT Language="JavaScript"> /* All Files are Designed & Writen by Windy_sk, you can use it freely but ... YOU MUST KEEP THIS ITEM ! Email: windy_sk@126.com */ function GetRandomNum(Min,Max){ var Range = Max - Min; var Rand = Math.random(); return(Min + Math.round(Rand * Range)); } function reportError(msg,url,line) { var str = "You have found an error as below: \n\n"; str += "Err: " + msg + " on line: " + line; alert(str); return true; } window.onerror = reportError; var info_bar = new Object(); var arc_obj = new Object(); var arc_lst = new Array(); var arc_timer = new Array(); var arc_time_unit = 200; var level = 1; var hp_max = 20; var hp_cur = 20; var lv_limit = 10; var lv_cur = 1; var lv_timer = null; var lv_time_unit = 1000; function arc_insert() { var idx = arc_lst.length; var cur_arc = arc_obj.cloneNode(); cur_arc.style.top = GetRandomNum(100, game_board.document.body.offsetHeight-100); cur_arc.style.left = GetRandomNum(100, game_board.document.body.offsetWidth-100); cur_arc.idx = idx; if(GetRandomNum(1,10)>8) { cur_arc.FillColor = "red"; cur_arc.StrokeColor = "red"; } else if(GetRandomNum(1,10)>9) { cur_arc.FillColor = "blue"; cur_arc.StrokeColor = "blue"; } cur_arc.onclick = arc_click; game_board.document.body.insertBefore(cur_arc); arc_lst[idx] = cur_arc; arc_timer[idx] = setInterval("arc_show("+idx+")",arc_time_unit); return; } function arc_show(idx) { var cur_arc = arc_lst[idx]; if(typeof(cur_arc) != "object") return; cur_arc.filters.alpha.opacity += 5; cur_arc.style.width = parseInt(cur_arc.style.width) - 5; cur_arc.style.height = parseInt(cur_arc.style.height) - 5; if(cur_arc.filters.alpha.opacity >= 100){ cur_arc.removeNode(); arc_lst[idx] = null; clearInterval(arc_timer[idx]); arc_timer[idx] = null; hp_cur--; hp_show.innerText = hp_cur + "/" + hp_max; modi_bar(hp_bar, hp_cur, hp_max); if(hp_cur <= 0) { for(var i=0; i<arc_lst.length; i++) { if(arc_timer[i] != null)clearInterval(arc_timer[i]); if(arc_lst[i] != null)arc_lst[i].removeNode(); } start.disabled = false; clearInterval(lv_timer); show_info("Game Over !") } } return; } function modi_bar(obj, cur, max) { var rate = Math.ceil(cur * 100 / max); if(isNaN(rate) || rate < 0)rate = 0; if(rate > 100) rate = 100; obj.rows[0].cells[0].style.width = rate + "%"; obj.rows[0].cells[1].style.width = (100 - rate) + "%"; return; } function arc_click() { var idx = game_board.event.srcElement.idx; var cur_arc = arc_lst[idx]; clearInterval(arc_timer[idx]); cur_arc.filters.alpha.opacity = 100; cur_arc.onclick = null; arc_timer[idx] = setInterval("arc_out("+idx+")", 10); point.innerText = parseInt(point.innerText) + 1 if(cur_arc.FillColor == "red") { hp_cur++; if(hp_cur > hp_max) hp_cur = hp_max; hp_show.innerText = hp_cur + "/" + hp_max; modi_bar(hp_bar, hp_cur, hp_max); } else if(cur_arc.FillColor == "blue") { hp_max++; hp_show.innerText = hp_cur + "/" + hp_max; modi_bar(hp_bar, hp_cur, hp_max); } return; } function arc_out(idx) { var cur_arc = arc_lst[idx]; cur_arc.style.left = parseInt(cur_arc.style.left) + 10; if(cur_arc.offsetLeft > screen.width){ cur_arc.removeNode(); arc_lst[idx] = null; clearInterval(arc_timer[idx]); arc_timer[idx] = null; } } function go_stage(lv) { if(isNaN(lv) || lv < 0) lv = 0; if(lv > 9) lv = 9; stg_lv.innerHTML = " " + (lv + 1) + " "; lv_cur = 1; lv_limit = 10 + lv * 10; stg_info.innerText = "1/" + lv_limit; modi_bar(stg_info_bar, lv_cur, lv_limit); lv_time_unit = 1000 - lv * 100; arc_lst = new Array(); arc_timer = new Array(); arc_insert(); lv_timer = setInterval("go_stage_step("+lv+")", lv_time_unit); } function go_stage_step(lv) { if(++lv_cur>lv_limit){ clearInterval(lv_timer); lv++; setTimeout("show_info('Stage " + lv + " Clear !')", 2000) setTimeout("go_stage("+lv+")", 5000); }else{ stg_info.innerText = lv_cur + "/" + lv_limit; modi_bar(stg_info_bar, lv_cur, lv_limit); arc_insert(); } } function show_info(str){ info_bar.filters.revealTrans.transition=GetRandomNum(1,23); info_bar.style.left=(game_board.document.body.offsetWidth-200)/2; info_bar.style.top =(game_board.document.body.offsetHeight-40)/4; info_bar.innerHTML="<table border=0 width=100% height=100%><tr><td align=center valign=middle style='font-size:16px; FONT-WEIGHT:bold;'>" + str + "</td></tr></table>"; info_bar.filters.revealTrans.apply(); info_bar.style.display = ""; info_bar.filters.revealTrans.play(); setTimeout("info_bar.style.display='none'",2000); } window.onload = function(){ game_board.document.open(); game_board.document.write("<html xmlns:v='urn:schemas-microsoft-com:vml'>\n<head>\n<title>Arc_Click</title>\n<STYLE>\n v\\:* { BEHAVIOR: url(#default#VML) }\n</STYLE>\n</head>\n<body scroll='no' onselectstart='return false' oncontextmenu='return false'></body>\n</html>"); game_board.document.close(); arc_obj = game_board.document.createElement("<v:arc style='position:absolute;width:100;height:100;filter:alpha(opacity=0);' StartAngle='0' EndAngle='360' Filled='true' FillColor='gray' StrokeColor='gray' StrokeWeight='1px' />"); info_bar = game_board.document.createElement("<div style='background-color: #eeeeee; width:200px; height:40px; FILTER: revealTrans(transition=23,duration=0.5) blendTrans(duration=0.5); position:absolute; text-align: center; border:0px solid black; display:none; zindex:999'></div>"); game_board.document.body.insertBefore(info_bar); } </SCRIPT> </head> <body scroll="no" onselectstart="return false"> <table style="border:0px;width:100%;height:100%"> <tr> <td> <iframe scrolling="no" id="game_board" src="about:blank" MARGINHEIGHT="0" MARGINWIDTH="0" style="width:100%; height:100%;"></iframe> </td> <td style="width:200px"> <table style="border:1px black solid;width:100%;height:100%"> <tr> <td valign="top"> <span style="font-family: Arial, Helvetica; font-size: 18px">Stage <span id="stg_lv"> 1 </span></span><br /> <br /> <table style="border:0px;width:100%"> <tr> <td width="60"><b>State :</b></td> <td> <table id="stg_info_bar" style="border:1px black solid;width:100px;height:100%"> <tr> <td style="width:100%; background-color:skyblue; height:10px"></td> <td style="width:0%"></td> </tr> </table> </td> <td width="20"><span id="stg_info">0/10</span></td> </tr> </table> <br /> <table style="border:0px;width:100%"> <tr> <td width="60"><b>Health:</b></td> <td> <table id="hp_bar" style="border:1px black solid;width:100px;height:100%"> <tr> <td style="width:100%; background-color:skyblue; height:10px"></td> <td style="width:0%"></td> </tr> </table> </td> <td width="20"><span id="hp_show">20/20</span></td> </tr> </table> <br /> <table style="border:0px;width:100%"> <tr> <td width="60"><b>Point :</b></td> <td><span id="point">0</span></td> </tr> </table> <br /> <center><input id="start" type="button" onclick="this.disabled=true;go_stage(0);hp_max=20" value="Start"></center> </td> </tr> </table> </td> </tr> </table> </body> </html> [Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運(yùn)行]
歡迎您進(jìn)入論壇進(jìn)行討論:http://www.95time.cn/bbs/NewsDetail.asp?id=1338267
出處:藍(lán)色理想 責(zé)任編輯:LeXRus
◎進(jìn)入論壇網(wǎng)頁制作、網(wǎng)站綜合版塊參加討論
藍(lán)色理想版權(quán)申明:除部分特別聲明不要轉(zhuǎn)載,或者授權(quán)我站獨(dú)家播發(fā)的文章外,大家可以自由轉(zhuǎn)載我站點(diǎn)的原創(chuàng)文章,但原作者和來自我站的鏈接必須保留(非我站原創(chuàng)的,按照原來自一節(jié),自行鏈接)。文章版權(quán)歸我站和作者共有。
轉(zhuǎn)載要求:轉(zhuǎn)載之圖片、文件,鏈接請(qǐng)不要盜鏈到本站,且不準(zhǔn)打上各自站點(diǎn)的水印,亦不能抹去我站點(diǎn)水印。
特別注意:本站所提供的攝影照片,插畫,設(shè)計(jì)作品,如需使用,請(qǐng)與原作者聯(lián)系,版權(quán)歸原作者所有,文章若有侵犯作者版權(quán),請(qǐng)與我們聯(lián)系,我們將立即刪除修改。