锘??xml version="1.0" encoding="utf-8" standalone="yes"?>成人福利视频导航,精品久久久久久最新网址,深夜视频在线免费http://www.aygfsteel.com/hughmay/articles/339383.html嫻﹂嫻﹂Tue, 30 Nov 2010 05:36:00 GMThttp://www.aygfsteel.com/hughmay/articles/339383.htmlhttp://www.aygfsteel.com/hughmay/comments/339383.htmlhttp://www.aygfsteel.com/hughmay/articles/339383.html#Feedback0http://www.aygfsteel.com/hughmay/comments/commentRss/339383.htmlhttp://www.aygfsteel.com/hughmay/services/trackbacks/339383.html
浠庣綉涓婃壘鍒扮殑鏉愭枡錛屾敹钘忓垎浜竴涓嬨?/span>
1. oncontextmenu="window.event.returnValue=false" 灝嗗交搴曞睆钄介紶鏍囧彸閿?/span>

<table border oncontextmenu=return(false)><td>no</table> 鍙敤浜嶵able

2. <body onselectstart="return false"> 鍙栨秷閫夊彇銆侀槻姝㈠鍒?/p>

3. onpaste="return false" 涓嶅噯綺樿創(chuàng)

4. oncopy="return false;" oncut="return false;" 闃叉澶嶅埗

5. <link rel="Shortcut Icon" href="favicon.ico"> IE鍦板潃鏍忓墠鎹㈡垚鑷繁鐨勫浘鏍?/p>

6. <link rel="Bookmark" href="favicon.ico"> 鍙互鍦ㄦ敹钘忓す涓樉紺哄嚭浣犵殑鍥炬爣

7. <input style="ime-mode:disabled"> 鍏抽棴杈撳叆娉?/p>

8. 姘歌繙閮戒細(xì)甯︾潃妗嗘灦
<script language="JavaScript"><!--
if (window == top)top.location.href = "frames.htm"; //frames.htm涓烘鏋剁綉欏?br /> // --></script>

9. 闃叉琚漢frame
<SCRIPT LANGUAGE=JAVASCRIPT><!-- 
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>

10. 緗戦〉灝嗕笉鑳借鍙﹀瓨涓?br /> <noscript><iframe src=*.html></iframe></noscript>

11. <input type=button value=鏌ョ湅緗戦〉婧愪唬鐮?nbsp;
onclick="window.location = "view-source:"+ "http://www.pconline.com.cn"">

12.鍒犻櫎鏃剁‘璁?br /> <a href="javascript:if(confirm("紜疄瑕佸垹闄ゅ悧?"))location="boos.asp?&areyou=鍒犻櫎&page=1"">鍒犻櫎</a>

13. 鍙栧緱鎺т歡鐨勭粷瀵逛綅緗?br /> //Javascript
<script language="Javascript">
function getIE(e){
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
}
alert("top="+t+"/nleft="+l);
}
</script>

//VBScript
<script language="VBScript"><!--
function getIE()
dim t,l,a,b
set a=document.all.img1
t=document.all.img1.offsetTop
l=document.all.img1.offsetLeft
while a.tagName<>"BODY"
set a = a.offsetParent
t=t+a.offsetTop
l=l+a.offsetLeft
wend
msgbox "top="&t&chr(13)&"left="&l,64,"寰楀埌鎺т歡鐨勪綅緗?
end function
--></script>

14. 鍏夋爣鏄仠鍦ㄦ枃鏈鏂囧瓧鐨勬渶鍚?br /> <script language="javascript">
function cc()
{
var e = event.srcElement;
var r =e.createTextRange();
r.moveStart("character",e.value.length);
r.collapse(true);
r.select();
}
</script>
<input type=text name=text1 value="123" onfocus="cc()">

15. 鍒ゆ柇涓婁竴欏電殑鏉ユ簮
javascript:
document.referrer

16. 鏈灝忓寲銆佹渶澶у寲銆佸叧闂獥鍙?br /> <object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> 
<param name="Command" value="Minimize"></object>
<object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> 
<param name="Command" value="Maximize"></object>
<OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM NAME="Command" VALUE="Close"></OBJECT>
<input type=button value=鏈灝忓寲 onclick=hh1.Click()>
<input type=button value=鏈澶у寲 onclick=hh2.Click()>
<input type=button value=鍏抽棴 onclick=hh3.Click()>
鏈緥閫傜敤浜嶪E

17.灞忚斀鍔熻兘閿甋hift,Alt,Ctrl
<script>
function look(){ 
if(event.shiftKey) 
alert("紱佹鎸塖hift閿?"); //鍙互鎹㈡垚ALT銆CTRL

document.onkeydown=look; 
</script>

18. 緗戦〉涓嶄細(xì)琚紦瀛?br /> <META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
鎴栬?lt;META HTTP-EQUIV="expires" CONTENT="0">

19.鎬庢牱璁╄〃鍗曟病鏈夊嚬鍑告劅錛?br /> <input type=text style="border:1 solid #000000"> 
鎴?br /> <input type=text style="border-left:none; border-right:none; border-top:none; border-bottom:

1 solid #000000"></textarea>

20.<div><span>&<layer>鐨勫尯鍒紵 
<div>(division)鐢ㄦ潵瀹氫箟澶ф鐨勯〉闈㈠厓绱狅紝浼?xì)漶旂敓铦{琛?nbsp;
<span>鐢ㄦ潵瀹氫箟鍚屼竴琛屽唴鐨勫厓绱狅紝璺?lt;div>鐨勫敮涓鍖哄埆鏄笉浜х敓杞 
<layer>鏄痭s鐨勬爣璁幫紝ie涓嶆敮鎸侊紝鐩稿綋浜?lt;div>

21.璁╁脊鍑虹獥鍙f繪槸鍦ㄦ渶涓婇潰:
<body onblur="this.focus();">

22.涓嶈婊氬姩鏉? 
璁╃珫鏉℃病鏈? 
<body style="overflow:scroll;overflow-y:hidden"> 
</body> 
璁╂í鏉℃病鏈? 
<body style="overflow:scroll;overflow-x:hidden"> 
</body> 
涓や釜閮藉幓鎺夛紵鏇寸畝鍗曚簡 
<body scroll="no"> 
</body>

23.鎬庢牱鍘繪帀鍥劇墖閾炬帴鐐瑰嚮鍚庯紝鍥劇墖鍛ㄥ洿鐨勮櫄綰匡紵
<a href="#" onFocus="this.blur()"><img src="logo.jpg" border=0></a>

24.鐢?shù)瀛愰偖錃g澶勭悊鎻愪氦琛ㄥ崟
<form name="form1" method="post" action="mailto:****@***.com" enctype="text/plain"> 
<input type=submit>
</form>

25.鍦ㄦ墦寮鐨勫瓙紿楀彛鍒鋒柊鐖剁獥鍙g殑浠g爜閲屽浣曞啓錛?br /> window.opener.location.reload()

26.濡備綍璁懼畾鎵撳紑欏甸潰鐨勫ぇ灝?br /> <body onload="top.resizeTo(300,200);">
鎵撳紑欏甸潰鐨勪綅緗?lt;body onload="top.moveBy(300,200);">

27.鍦ㄩ〉闈腑濡備綍鍔犲叆涓嶆槸婊¢摵鐨勮儗鏅浘鐗?鎷夊姩欏甸潰鏃惰儗鏅浘涓嶅姩 
<STYLE> 
body 
{background-image:url(logo.gif); background-repeat:no-repeat; 
background-position:center;background-attachment: fixed} 
</STYLE>

28. 媯(gè)鏌ヤ竴孌靛瓧絎︿覆鏄惁鍏ㄧ敱鏁板瓧緇勬垚
<script language="Javascript"><!--
function checkNum(str){return str.match(//D/)==null}
alert(checkNum("1232142141"))
alert(checkNum("123214214a1"))
// --></script>

29. 鑾峰緱涓涓獥鍙g殑澶у皬
document.body.clientWidth; document.body.clientHeight

30. 鎬庝箞鍒ゆ柇鏄惁鏄瓧絎?br /> if (/[^/x00-/xff]/g.test(s)) alert("鍚湁姹夊瓧");
else alert("鍏ㄦ槸瀛楃");

31.TEXTAREA鑷傚簲鏂囧瓧琛屾暟鐨勫灝?br /> <textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight">
</textarea>

32. 鏃ユ湡鍑忓幓澶╂暟絳変簬絎簩涓棩鏈?br /> <script language=Javascript>
function cc(dd,dadd)
{
//鍙互鍔犱笂閿欒澶勭悊
var a = new Date(dd)
a = a.valueOf()
a = a - dadd * 24 * 60 * 60 * 1000
a = new Date(a)
alert(a.getFullYear() + "騫? + (a.getMonth() + 1) + "鏈? + a.getDate() + "鏃?)
}
cc("12/23/2002",2)
</script>

33. 閫夋嫨浜嗗摢涓涓猂adio
<HTML><script language="vbscript">
function checkme()
for each ob in radio1
if ob.checked then window.alert ob.value
next
end function
</script><BODY>
<INPUT name="radio1" type="radio" value="style" checked>Style
<INPUT name="radio1" type="radio" value="barcode">Barcode
<INPUT type="button" value="check" onclick="checkme()">
</BODY></HTML>

34.鑴氭湰姘鎬笉鍑洪敊
<SCRIPT LANGUAGE="JavaScript"> 
<!-- Hide 
function killErrors() { 
return true; 

window.onerror = killErrors; 
// --> 
</SCRIPT>

35.ENTER閿彲浠ヨ鍏夋爣縐誨埌涓嬩竴涓緭鍏ユ
<input onkeydown="if(event.keyCode==13)event.keyCode=9">

36. 媯(gè)嫻嬫煇涓綉绔欑殑閾炬帴閫熷害錛?br /> 鎶婂涓嬩唬鐮佸姞鍏?lt;body>鍖哄煙涓?
<script language=Javascript>
tim=1
setInterval("tim++",100)
b=1
var autourl=new Array()
autourl[1]="www.njcatv.net"
autourl[2]="javacool.3322.net"
autourl[3]="www.sina.com.cn"
autourl[4]="www.nuaa.edu.cn"
autourl[5]="www.cctv.com"
function butt(){
document.write("<form name=autof>")
for(var i=1;i<autourl.length;i++)
document.write("<input type=text name=txt"+i+" size=10 value=嫻嬭瘯涓?.....> =銆?lt;input type=text 
name=url"+i+" size=40> =銆?lt;input type=button value=GO

onclick=window.open(this.form.url"+i+".value)><br>")
document.write("<input type=submit value=鍒鋒柊></form>")
}
butt()
function auto(url){
document.forms[0]["url"+b].value=url
if(tim>200)
{document.forms[0]["txt"+b].value="閾炬帴瓚呮椂"}
else
{document.forms[0]["txt"+b].value="鏃墮棿"+tim/10+"縐?}
b++
}
function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl+"/"+Math.random()+" width=1 height=1

onerror=auto("http://"+autourl+"")>")}
run()</script>

37. 鍚勭鏍峰紡鐨勫厜鏍?br /> auto 錛氭爣鍑嗗厜鏍?br /> default 錛氭爣鍑嗙澶?br /> hand 錛氭墜褰㈠厜鏍?br /> wait 錛氱瓑寰呭厜鏍?br /> text 錛欼褰㈠厜鏍?br /> vertical-text 錛氭按騫矷褰㈠厜鏍?br /> no-drop 錛氫笉鍙嫋鍔ㄥ厜鏍?br /> not-allowed 錛氭棤鏁堝厜鏍?br /> help 錛?甯姪鍏夋爣
all-scroll 錛氫笁瑙掓柟鍚戞爣
move 錛氱Щ鍔ㄦ爣
crosshair 錛氬崄瀛楁爣
e-resize
n-resize
nw-resize
w-resize
s-resize
se-resize
sw-resize

38.欏甸潰榪涘叆鍜岄鍑虹殑鐗規(guī)晥
榪涘叆欏甸潰<meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)">
鎺ㄥ嚭欏甸潰<meta http-equiv="Page-Exit" content="revealTrans(duration=x, transition=y)">  
榪欎釜鏄〉闈㈣杞藉叆鍜岃皟鍑烘椂鐨勪竴浜涚壒鏁堛俤uration琛ㄧず鐗規(guī)晥鐨勬寔緇椂闂達(dá)紝浠ョ涓哄崟浣嶃倀ransition琛ㄧず浣跨敤鍝鐗規(guī)晥錛屽彇鍊間負(fù)1-23:
0 鐭╁艦緙╁皬 
1 鐭╁艦鎵╁ぇ 
2 鍦嗗艦緙╁皬
3 鍦嗗艦鎵╁ぇ 
4 涓嬪埌涓婂埛鏂?nbsp;
5 涓婂埌涓嬪埛鏂?br /> 6 宸﹀埌鍙沖埛鏂?nbsp;
7 鍙沖埌宸﹀埛鏂?nbsp;
8 绔栫櫨鍙剁獥
9 妯櫨鍙剁獥 
10 閿欎綅妯櫨鍙剁獥 
11 閿欎綅绔栫櫨鍙剁獥
12 鐐規(guī)墿鏁?nbsp;
13 宸﹀彸鍒頒腑闂村埛鏂?nbsp;
14 涓棿鍒板乏鍙沖埛鏂?br /> 15 涓棿鍒頒笂涓?br /> 16 涓婁笅鍒頒腑闂?nbsp;
17 鍙充笅鍒板乏涓?br /> 18 鍙充笂鍒板乏涓?nbsp;
19 宸︿笂鍒板彸涓?nbsp;
20 宸︿笅鍒板彸涓?br /> 21 妯潯 
22 绔栨潯 
23 浠ヤ笂22縐嶉殢鏈洪夋嫨涓縐?/p>

39.鍦ㄨ瀹氭椂闂村唴璺寵漿
<META http-equiv=V="REFRESH" content="5;URL=http://www.51js.com">

40.緗戦〉鏄惁琚绱?br /> <meta name="ROBOTS" content="灞炴у?>
鍏朵腑灞炴у兼湁浠ヤ笅涓浜?
灞炴у間負(fù)"all": 鏂囦歡灝嗚媯(gè)绱紝涓旈〉涓婇摼鎺ュ彲琚煡璇紱
灞炴у間負(fù)"none": 鏂囦歡涓嶈媯(gè)绱紝鑰屼笖涓嶆煡璇㈤〉涓婄殑閾炬帴錛?br /> 灞炴у間負(fù)"index": 鏂囦歡灝嗚媯(gè)绱紱
灞炴у間負(fù)"follow": 鏌ヨ欏典笂鐨勯摼鎺ワ紱
灞炴у間負(fù)"noindex": 鏂囦歡涓嶆绱紝浣嗗彲琚煡璇㈤摼鎺ワ紱
灞炴у間負(fù)"nofollow": 鏂囦歡涓嶈媯(gè)绱紝浣嗗彲鏌ヨ欏典笂鐨勯摼鎺ャ?/p>

鏈澶у寲紿楀彛錛?br /> <script language="JavaScript">
<!--
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
//-->
</script>


瑙e喅闂錛氱敱浜庡眰涓庝笅鎷夋涔嬮棿鐨勪紭鍏堢駭鏄細(xì)涓嬫媺妗?> 灞傦紝鍥犳鍦ㄦ樉紺虹殑鏃跺欙紝浼?xì)鍥犱皋Z紭鍏堢駭鐨勬搴忚屼細(xì)鍑虹幇濡備笂闂銆傦紙濡傛灉鍑犱釜鍏冪礌閮芥槸灞傜殑璇濓紝鎴戜滑鍙互閫氳繃灞傜殑 z-index 灞炴ф潵璁劇疆錛夎В鍐沖姙娉曞氨鏄細(xì)緇欏眰涓斁涓涓紭鍏堢駭姣斾笅鎷夋鏇撮珮鐨勫厓绱狅紙iframe錛夛紝浠庤岃В鍐蟲闂錛佸叿浣撹В鍐充唬鐮佸涓嬶細(xì)

<div id="menu" style="position:absolute; visibility:hidden; top:20px; left:20px; width:100px; height:200px; background-color:#6699cc;">
  <table>
  <tr><td>item 1</td></tr>
  <tr><td>item 2</td></tr>
  <tr><td>item 3</td></tr>
  <tr><td>item 4</td></tr>
  <tr><td>item 5</td></tr>
  </table>
  <iframe src="javascript:false" style="position:absolute; visibility:inherit; top:0px; left:0px; width:100px; height:200px; z-index:-1; filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';"></iframe>
</div>

<a href="#" onclick="document.getElementById('menu').style.visibility='visible'">menu</a>

<form>
  <select><option>A form selection list</option></select>
</form>

杈撳叆妗嗕篃鍙互鍋氱殑寰堟紓浜簡
<div align="center"><input type="hidden" name="hao" value="yes">
              澶栧悜鏁幫細(xì)<input 
      name=answer 
      style="color: rgb(255,0,0); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1px solid rgb(192,192,192)">
            銆娌″洖絳旂殑棰樻暟錛?lt;input 
      name=unanswer id="unanswer" 
      style="color: rgb(255,0,0); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1px solid rgb(192,192,192)">
            <br>
            鎬誨緱鍒?
            <input 
      name=score id="score" 
      style="color: rgb(255,0,0); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1px solid rgb(192,192,192)">
            銆緇撱銆銆銆璁?
            <input 
      name=xgjg id="xgjg" 
      style="color: rgb(255,0,0); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1px solid rgb(192,192,192)">
            <br>
            <br> 
            
            <input onClick=processForm(this.form) style="FONT-FAMILY: 瀹嬩綋; FONT-SIZE: 9pt" type=button value=鏌ョ湅緇撴灉 name="button"> 
             <input type="reset" name="Submit" value="閲嶅仛">
            </div>


娉ㄦ剰錛氫慨鏀?lt;body>涓?lt;body onload="max.Click()">鍗充負(fù)鎵撳紑鏈澶?/p>

鍖栫獥鍙o紝鑰屽鏋滄敼涓?lt;body onload="min.Click()">灝卞彉涓虹獥鍙d竴鎵撳紑灝辨渶灝忓寲

<object id="min" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
            <param name="Command" value="Minimize">
          </object> <object id="max" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
            <param name="Command" value="Maximize">
          </object>
</body>

欏甸潰鑷姩鍒鋒柊錛堣鏄庯級(jí)

褰撲綘鍋氱綉欏墊椂錛屾槸涓嶆槸鏈夌殑鏃跺欐兂璁╀綘鐨勭綉欏佃嚜鍔ㄤ笉鍋滃埛鏂幫紝鎴栬呰繃涓孌墊椂闂磋嚜鍔ㄨ煩杞埌鍙﹀涓涓綘鑷繁璁懼畾鐨勯〉闈紵鍏跺疄瀹炵幇榪欎釜鏁堟灉闈炲父鍦扮畝鍗曪紝鑰屼笖榪欎釜鏁堟灉鐢氳嚦涓嶈兘縐頒箣涓虹壒鏁堛備綘鍙鎶婂涓嬩唬鐮佸姞鍏ヤ綘鐨勭綉欏典腑灝卞彲浠ヤ簡銆?/p>

1錛岄〉闈㈣嚜鍔ㄥ埛鏂幫細(xì)鎶婂涓嬩唬鐮佸姞鍏?lt;head>鍖哄煙涓?lt;meta http-equiv="refresh" content="20">,鍏朵腑20鎸囨瘡闅?0縐掑埛鏂頒竴嬈¢〉闈?

2錛岄〉闈㈣嚜鍔ㄨ煩杞細(xì)鎶婂涓嬩唬鐮佸姞鍏?lt;head>鍖哄煙涓?lt;meta http-equiv="refresh" content="20;url=http://www.StSky.Com">,鍏朵腑20鎸囬殧20縐掑悗璺寵漿鍒?a style="text-decoration: none; color: #336699; ">http://www.StSky.Com欏甸潰銆?/p>

欏甸潰鑷姩鍏抽棴

5000鏄寚鏃墮棿<body onLoad="setTimeout(window.close, 5000)">

寮瑰嚭紿楀彛鑷姩鍏抽棴

10縐掑悗寮瑰嚭紿楀彛鑷姩鍏抽棴

娉ㄦ剰錛氬湪鏂扮殑tan.htm鐨刡ody涓鍔?<onLoad="closeit()">
head


<script language="JavaScript">

<!--

var gt = unescape('%3e');

var popup = null;

var over = "Launch Pop-up Navigator";

popup = window.open('', 'popupnav', 'width=225,height=235,resizable=1,scrollbars=auto');

if (popup != null) {

if (popup.opener == null) {

popup.opener = self;

}

popup.location.href = 'tan.htm';

}

// -->

</script>
<body>娉ㄦ剰錛氳繖孌典唬鐮佹槸鍦ㄦ柊寤烘枃浠朵腑鐨?br /> <script language="JavaScript">

function closeit() {

setTimeout("self.close()",10000)

}

</script>

榪欎釜鍙笉鏄?lt;iframe>(寮曠敤錛夊憖銆傛槸鐩存帴璋冪敤鐨勩備互涓嬩唬鐮佸姞鍏?lt;body>鍖哄煙

<object type="text/x-scriptlet" width="800"  height="1000" data="../index.htm">
</object>



嫻﹂ 2010-11-30 13:36 鍙戣〃璇勮
]]>
Java_鍒濈駭緙栫▼錛岀寽鑻辨枃鍗曡瘝娓告垙http://www.aygfsteel.com/hughmay/archive/2010/11/23/338854.html嫻﹂嫻﹂Tue, 23 Nov 2010 14:40:00 GMThttp://www.aygfsteel.com/hughmay/archive/2010/11/23/338854.htmlhttp://www.aygfsteel.com/hughmay/comments/338854.htmlhttp://www.aygfsteel.com/hughmay/archive/2010/11/23/338854.html#Feedback1http://www.aygfsteel.com/hughmay/comments/commentRss/338854.htmlhttp://www.aygfsteel.com/hughmay/services/trackbacks/338854.html澶у濂斤紝榪欐槸鎴戠涓嬈″湪BlogJava鍙戝笘錛屾湰浜洪叿鐖辯紪紼嬶紝鍔犲叆BlogJava紺懼尯錛屽氨鏄負(fù)浜嗚璇嗙粨浜ゆ洿澶氭湁鍏卞悓鍏磋叮鐖卞ソ鐨勬湅鍙嬶紝浜ゆ祦褰兼瀛︿範(fàn)緙栫▼鐨勭粡楠岋紝璇峰ぇ瀹跺澶氭敮鎸佹垜
涓嬮潰鐨凧ava紼嬪簭鏄垜瀛︿範(fàn)Java鍒濇湡鐨勪竴涓綔涓氾細(xì)鐚滆嫳鏂囧崟璇嶆父鎴忥紝浣滀負(fù)鎴態(tài)log絎竴綃囬殢絎旓紝榪欎釜紼嬪簭涔熷彲浠ョ洿鎺ョ偣鍑?a href="/Files/hughmay/Assignment_1.zip" style="color: #002c99; text-decoration: none; ">http://www.aygfsteel.com/Files/hughmay/Assignment_1.zip涓嬭澆錛岀劧鍚庤緭鍏ワ紙import錛夊埌Java緙栬緫杞歡錛屽eclipse銆傜洿鎺ヨ繍琛岃紼嬪簭銆?/div>
/*
 * Author: ZHUANG JIN YI_91237 
 * This program is a simple game application (GUI) that allows two players compete with each other 
 * by guessing a word from a pool of 10 letters. Players can choose to pass to next player or choose to quit to end this game :)
 * 2010 Copyright Zhuang Jinyi, Jason. 
 */

import java.util.*;
import javax.swing.*;

public class FindYourWords 
{
public static void main(String[] args) 
{
Scanner console = new Scanner (System.in);
Random generator = new Random();
String [] dict= FileUtil.readDictFromFile("words.txt");
int scorePlayerA = 0;
int scorePlayerB = 0;
int sumScoreA = 0;
int sumScoreB = 0;
int i;
int match = 0;
int match1 = 0;
int match2 = 0;
int match3 = 0;
int[] ranNum = new int[8];
int[] ranNumVowel = new int[2];
String junk;
String[] letters = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "g", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
String[] vowels = {"a", "e", "i", "o", "u"};
String[] randomLetter = new String[8];
String[] randomVowel = new String[2];
String playerAInput = "";
String playerBInput = "";
String[] point1 = {"E" ,"A" ,"O" ,"T", "I", "N", "R", "S", "L", "U"};
String[] point2 = {"D", "G"};
String[] point3 = {"C", "M","B", "P"};
String[] point4 = {"H","F", "W", "Y"}; 
String[] point5 = {"K"}; 
String[] point8 = {"J", "X"};  
String[] point10 = {"Q", "Z"}; 

JOptionPane.showMessageDialog (null, "-----------------------------------------Game: Find Your Words-----------------------------------------\n" + "=======================Ready to Play? Click 'Ok'=======================", "Find Your Words", JOptionPane.INFORMATION_MESSAGE);
try
{
while (!playerAInput.equalsIgnoreCase("!") && !playerBInput.equalsIgnoreCase("!"))
{
if (!playerAInput.equalsIgnoreCase("!") || playerBInput.equalsIgnoreCase("@"))
{
//random letters generation  
for (i = 0; i < ranNum.length; i++ )
{
ranNum[i] = generator.nextInt(26);
randomLetter[i] = letters[ranNum[i]];
}
for (i = 0; i < ranNumVowel.length; i++ )
{
ranNum[i] = generator.nextInt(5);
randomVowel[i] = vowels[ranNum[i]];
}
//store random letters & prompt user input 
String[] randomQues = {randomLetter[0], randomVowel[1], randomLetter[1], randomVowel[0], randomLetter[2], randomLetter[3], randomLetter[4], randomLetter[5], randomLetter[6], randomLetter[7]};
//GUI dialog box 
String randomLetters = "Letters of Player A: " + randomLetter[0] + " " + randomVowel[1] + " " + randomLetter[1] + " " + randomVowel[0] + " " + randomLetter[2] + " " + randomLetter[3] + " " +  randomLetter[4] + " " + randomLetter[5] + " " + randomLetter[6] + " " + randomLetter[7];
playerAInput = JOptionPane.showInputDialog (randomLetters + "\n" + "Enter your word (or ‘@’ to pass or ‘!’ to quit): ");
String[] playerA = new String[playerAInput.length()];
playerA = playerAInput.split("");
/*
for (i = 0; i < playerA.length; i++)
{
System.out.println(playerA[i]);
}
System.out.println(playerA.length);
*/
while (!playerAInput.equalsIgnoreCase("@") && !playerAInput.equalsIgnoreCase("!"))
{
//checking validity part 
scorePlayerA = 0;
match = 0;
match1 = 0;
for (i = 0; i < dict.length; i++)
{
if (dict[i].equalsIgnoreCase(playerAInput))
{
match += 1;
}
else
{
match += 0;
}
}
if (match >= 1)
{
for (i = 0; i < playerA.length; i++)
{
for (int m = 0; m < randomQues.length; m++)
{
if (playerA[i].equalsIgnoreCase(randomQues[m]))
{
match1 += 1;
break;
}
}
}
if (match1 >= (playerA.length - 1))
{
//Giving points to players
for (i = 0; i < playerA.length; i++)
{
for (int m = 0; m < point1.length; m++)
{
if (point1[m].equalsIgnoreCase(playerA[i]))
{
scorePlayerA += 1;
}
}
}
for (i = 0; i < playerA.length; i++)
{
for (int m = 0; m < point2.length; m++)
{
if (point2[m].equalsIgnoreCase(playerA[i]))
{
scorePlayerA += 2;
}
}
}
for (i = 0; i < playerA.length; i++)
{
for (int m = 0; m < point3.length; m++)
{
if (point3[m].equalsIgnoreCase(playerA[i]))
{
scorePlayerA += 3;
}
}
}
for (i = 0; i < playerA.length; i++)
{
for (int m = 0; m < point4.length; m++)
{
if (point4[m].equalsIgnoreCase(playerA[i]))
{
scorePlayerA += 4;
}
}
}
for (i = 0; i < playerA.length; i++)
{
for (int m = 0; m < point5.length; m++)
{
if (point5[m].equalsIgnoreCase(playerA[i]))
{
scorePlayerA += 5;
}
}
}
for (i = 0; i < playerA.length; i++)
{
for (int m = 0; m < point8.length; m++)
{
if (point8[m].equalsIgnoreCase(playerA[i]))
{
scorePlayerA += 8;
}
}
}
for (i = 0; i < playerA.length; i++)
{
for (int m = 0; m < point10.length; m++)
{
if (point10[m].equalsIgnoreCase(playerA[i]))
{
scorePlayerA += 10;
}
}
}
sumScoreA += scorePlayerA;
/*
System.out.println("Total score for word: " + scorePlayerA);
System.out.println("Total score for game: " + sumScoreA);
*/
String result = "Total score for word: " + scorePlayerA + "\n" + "Total score for game: " + sumScoreA;
JOptionPane.showMessageDialog(null, result, "This Round Result :)", JOptionPane.INFORMATION_MESSAGE);
break;
}
else
{
JOptionPane.showMessageDialog(null, "Error : A valid word is formed but one or more letter(s) used are not yours.", "Error :(", JOptionPane.QUESTION_MESSAGE);
playerAInput = JOptionPane.showInputDialog (randomLetters + "\n" + "Enter your word (or ‘@’ to pass or ‘!’ to quit): ");
playerA = playerAInput.split("");
}
}
else
{
JOptionPane.showMessageDialog(null, "Error : An invalid word is formed.", "Error :(", JOptionPane.ERROR_MESSAGE);
playerAInput = JOptionPane.showInputDialog (randomLetters + "\n" + "Enter your word (or ‘@’ to pass or ‘!’ to quit): ");
playerA = playerAInput.split("");
}
}
}
if (!playerAInput.equalsIgnoreCase("!") || playerAInput.equalsIgnoreCase("@"))
{
//random letters generation 
for (i = 0; i < ranNum.length; i++ )
{
ranNum[i] = generator.nextInt(26);
randomLetter[i] = letters[ranNum[i]];
}
for (i = 0; i < ranNumVowel.length; i++ )
{
ranNum[i] = generator.nextInt(5);
randomVowel[i] = vowels[ranNum[i]];
}
//store random letters & prompt user input 
String[] randomQues1 = {randomLetter[0], randomVowel[1], randomLetter[1], randomVowel[0], randomLetter[2], randomLetter[3], randomLetter[4], randomLetter[5], randomLetter[6], randomLetter[7]};
//GUI dialog box 
String randomLetters1 = "Letters of Player B: " + randomLetter[0] + " " + randomVowel[1] + " " + randomLetter[1] + " " + randomVowel[0] + " " + randomLetter[2] + " " + randomLetter[3] + " " +  randomLetter[4] + " " + randomLetter[5] + " " + randomLetter[6] + " " + randomLetter[7];
playerBInput = JOptionPane.showInputDialog (randomLetters1 + "\n" + "Enter your word (or ‘@’ to pass or ‘!’ to quit): ");
String[] playerB = new String[playerBInput.length()];
playerB = playerBInput.split("");

while (!playerBInput.equalsIgnoreCase("@") && !playerBInput.equalsIgnoreCase("!"))
{
//checking validity part 
scorePlayerB = 0;
match2 = 0;
match3 = 0;
for (i = 0; i < dict.length; i++)
{
if (dict[i].equalsIgnoreCase(playerBInput))
{
match2 += 1;
}
else
{
match2 += 0;
}
}
if (match2 >= 1)
{
for (i = 0; i < playerB.length; i++)
{
for (int m = 0; m < randomQues1.length ; m++)
{
if (playerB[i].equalsIgnoreCase(randomQues1[m]))
{
match3 += 1;
break;
}
}
}
if (match3 >= (playerB.length - 1))
{
//Giving points to players
for (i = 0; i < playerB.length; i++)
{
for (int m = 0; m < point1.length; m++)
{
if (point1[m].equalsIgnoreCase(playerB[i]))
{
scorePlayerB += 1;
}
}
}
for (i = 0; i < playerB.length; i++)
{
for (int m = 0; m < point2.length; m++)
{
if (point2[m].equalsIgnoreCase(playerB[i]))
{
scorePlayerB += 2;
}
}
}
for (i = 0; i < playerB.length; i++)
{
for (int m = 0; m < point3.length; m++)
{
if (point3[m].equalsIgnoreCase(playerB[i]))
{
scorePlayerB += 3;
}
}
}
for (i = 0; i < playerB.length; i++)
{
for (int m = 0; m < point4.length; m++)
{
if (point4[m].equalsIgnoreCase(playerB[i]))
{
scorePlayerB += 4;
}
}
}
for (i = 0; i < playerB.length; i++)
{
for (int m = 0; m < point5.length; m++)
{
if (point5[m].equalsIgnoreCase(playerB[i]))
{
scorePlayerB += 5;
}
}
}
for (i = 0; i < playerB.length; i++)
{
for (int m = 0; m < point8.length; m++)
{
if (point8[m].equalsIgnoreCase(playerB[i]))
{
scorePlayerB += 8;
}
}
}
for (i = 0; i < playerB.length; i++)
{
for (int m = 0; m < point10.length; m++)
{
if (point10[m].equalsIgnoreCase(playerB[i]))
{
scorePlayerB += 10;
}
}
}
sumScoreB += scorePlayerB;
String result1 = "Total score for word: " + scorePlayerB + "\n" + "Total score for game: " + sumScoreB;
JOptionPane.showMessageDialog(null, result1, "This Round Result :)", JOptionPane.INFORMATION_MESSAGE);
break;
}
else
{
JOptionPane.showMessageDialog(null, "Error : A valid word is formed but one or more letter(s) used are not yours.", "Error :(", JOptionPane.QUESTION_MESSAGE);
playerBInput = JOptionPane.showInputDialog (randomLetters1 + "\n" + "Enter your word (or ‘@’ to pass or ‘!’ to quit): ");
playerB = playerBInput.split("");
}
}
else
{
JOptionPane.showMessageDialog(null, "Error : An invalid word is formed.", "Error :(", JOptionPane.ERROR_MESSAGE);
playerBInput = JOptionPane.showInputDialog (randomLetters1 + "\n" + "Enter your word (or ‘@’ to pass or ‘!’ to quit): ");
playerB = playerBInput.split("");
}
}
}
}
//Calculate and compare the final result
if (sumScoreA > sumScoreB)
{
String finalResult = "Total score for Player A: " + sumScoreA + "\n" + "Total score for Player B: " + sumScoreB + "\n" + "Player A wins!";
JOptionPane.showMessageDialog (null, "(: *********************Final Result********************* :)\n" + finalResult, "Final Result :)", JOptionPane.INFORMATION_MESSAGE);
}
else if (sumScoreA < sumScoreB)
{
String finalResult = "Total score for Player A: " + sumScoreA + "\n" + "Total score for Player B: " + sumScoreB + "\n" + "Player B wins!";
JOptionPane.showMessageDialog (null, "(: *********************Final Result********************* :)\n" + finalResult, "Final Result :)", JOptionPane.INFORMATION_MESSAGE);
}
else if (sumScoreA == sumScoreB)
{
String finalResult = "Total score for Player A: " + sumScoreA + "\n" + "Total score for Player B: " + sumScoreB + "\n" + "The result is a draw!";
JOptionPane.showMessageDialog (null, "(: *********************Final Result********************* :)\n" + finalResult, "Final Result :)", JOptionPane.INFORMATION_MESSAGE);
}
}
catch (Exception e)
{
junk = console.nextLine();
String errorMessage = "Error, " + junk + " is not acceptable!" + "\n" + "Sorry, Game Over" + "\n" + "Please run this program again :)";
JOptionPane.showMessageDialog (null, errorMessage, "Error Message :(", JOptionPane.INFORMATION_MESSAGE);
}
}
}
PS錛?good night :)


嫻﹂ 2010-11-23 22:40 鍙戣〃璇勮
]]> 主站蜘蛛池模板: 玉门市| 常山县| 道真| 五指山市| 历史| 炉霍县| 犍为县| 天气| 金溪县| 醴陵市| 湾仔区| 凌源市| 新干县| 荔波县| 花莲县| 教育| 遂昌县| 会同县| 金沙县| 双峰县| 新余市| 察哈| 永川市| 泽州县| 山东| 梧州市| 神农架林区| 资兴市| 修水县| 东乡族自治县| 龙南县| 泽普县| 甘南县| 南川市| SHOW| 读书| 天津市| 卢龙县| 峨山| 崇文区| 陵水|