文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>用 Quick Click 练习鼠标定位

用 Quick Click 练习鼠标定位

时间:2007-02-17  来源:PHP爱好者

没什么实际用途,纯属消遣

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: [email protected]*/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: nn"; 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 != null)clearInterval(arc_timer); if(arc_lst != null)arc_lst.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;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; 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%; <tr> <td> <iframe scrolling="no" id="game_board" src="about:blank" MARGINHEIGHT="0" MARGINWIDTH="0" style="width:100%; "></iframe> </td> <td style="width:200px"> <table style="border:1px black solid;width: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; <tr> <td style="width:100%; background-color:skyblue; </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; <tr> <td style="width:100%; background-color:skyblue; </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 全部选择 提示:你可先修改部分代码,再按运行]
非常全面的一个php技术网站,php 爱好者站 http://www.phpfans.net 有相当丰富的文章和源代码.
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载