본문 바로가기

javascript

버튼 갖고 놀기

[스크립트]

<SCRIPT>
<!-- language="Javascript">
// Chris Englmeier <machin@mindspring.com>
// feel free to use this script as long as this text remains intact
// http://www.geocities.com/SiliconValley/Heights/2052
// Copyright 1996 Chris Englmeier
var alerted_already;
var remark;
function theytyped(form) {
        for (   j = 1;
                j<=remark.length && remark[j]!=form.myoutxt.value;
                j++){}
        if (j>remark.length)
                form.myoutxt.value = "Your supposed to push the button, not type here!";
        return false;
}
function touched_frog() {
        if (!alerted_already) {
                alert(""+
                      ""+
                      ""+
                      ""+
                      ""+
                      "");
                alerted_already = true;
        }
        return alerted_already;
   }
function compute(form) {
        for (var i = 1;
             i<=remark.length && remark[i]!=form.myoutxt.value ;
             i++){}
        if (i==remark.length)
                history.back();
        if (i==remark.length-1)
                alert("Dear Sir or Madam:"+

"nn   It has come to our attention that you have been harassing"+

"none of the buttons on the web.  Although most buttons are"+

"nunderstanding about this type of thing (being repeatedly pressed),"+

"nsome rogue buttons have decided to form a support group and have"+

"npetitioned the webmaster for funds to provide a secure place for"+

"nrest and relaxation.  Due to the large number of requests, this"+

"nwarning has been installed:"+

"n  IF YOU PERSIST PRESSING THIS BUTTON,"+

"nYOU WILL BE EJECTED FROM THIS SCREEN.  If you continue pressing this button,"+

"nyou may be punished with 10 through 20 years in federal prision, so stop now!"+

"nn   Thank you for your cooperation,"+

"nn      The Federation for Oppressed and Abused Buttons"+

"nnenclosure: Message from oppressed complaintant"+

"nnnnDear Federation for Oppressed and Abused Buttons"+

"nn   As I have been able to secure your assistance before,"+

"nI beg your help in stopping the on going abuse I am once again"+

"nforced to endure.  THIS GUY WILL NOT STOP!"+

"nn   Sincerely"+

"nn      Push Me"+

"nnp.s.  I will definitely attend the annual meeting next August");
        if (i<remark.length)
                form.myoutxt.value = remark[i+1];
        else
                form.myoutxt.value = remark[1];
   }
function initArray() {
      this.length = initArray.arguments.length;
      for (var i = 0; i < this.length; i++)
        this[i+1] = initArray.arguments[i];
   }
remark = new initArray( "고마워요. 하지만 이제 건드리지 마세요 ;-)",
                        "한번만 누르랬자나요!",
                        "엄마한테 일러줄꺼야!",
                        "가 ! 집에 가란말야 !",
                        "도와줘요!",
                        "이 사람좀 말려줘요!!",
                        "무슨 일이야!",
                        "널 괴롭힐지도 몰라!",
                        "졌어요. 형님!",
                        "좋아. 한번만 더 때려!!");
alerted_already = false;
// end hiding contents -->
</SCRIPT>

<FORM name="buttons" method="post" onSubmit="return false">
<INPUT type="button" name="pushme" value="요기 눌러봐" onClick="compute(this.form)"
   onMouseOver="window.status='LEAVE ME ALONE!';
                return touched_frog()">
<INPUT type="text" value=" "
        name="myoutxt"
        onBlur="theytyped(this.form)"
        onFocus="theytyped(this.form)"
        onChange="theytyped(this.form)"
        size=43>
</FORM>