»
EnglishFrenchVietnamese

Print - Irritating Button 2.0 - JavaScriptBank.com

Full version: jsB@nk » Funny » Irritating Button 2.0
URL: https://www.javascriptbank.com/irritatingbutton.html

Irritating Button 2.0 © JavaScriptBank.comThis JavaScript will create a button which can move everywhere on the web page if user drag mouse on it.

Full version: jsB@nk » Funny » Irritating Button 2.0
URL: https://www.javascriptbank.com/irritatingbutton.html



JavaScript
<SCRIPT language=JavaScript>/*INSTRUCTIONSBack up this file firstDo you see the array of messages somewhere below which looks like...msg[0]msg[1]...msg[6].....That array can be of any length.That means you can ad more.i.e below msg[7] you can add another line like this:msg[8]="Whatever message you want the button to give the user";and the button will give this message also, as it randomizes messages. It shouldn't be too long and don't remove the quotes and semi-colon. Go on adding as many as you wish by incrementing the index in square brackets.Also you can change the value of the message the buton should first show. Change the value of init_msg just below....and don't remove the quotes and semi-colon*/init_msg="Hey you! I bet you can't click me";kb='False';function go_diff(){var msg=new Array()msg[0]="Come on! Get me";msg[1]="Hey! Over here!";msg[2]="Too slow!";msg[3]="Haha Hehe";msg[4]="Missed me!";msg[5]="Hoo Hoo Hoooo!";msg[6]="Fine! I won't move";msg[7]="I'm too fast for ya!";//Dont edit after this....var num1=parseInt(Math.random()*(width-150));var num2=parseInt(Math.random()*(height-150));var num3=parseInt(Math.random()*msg.length);ActualObj.left=num1;ActualObj.top=num2;document.silly.you.value=msg[num3];}function start(){if(document.all){ActualObj=eval(document.all.floatLyr.style);width=document.body.clientWidth;height=document.body.clientHeight;}else if(document.layers){ActualObj=eval(document.floatLyr.document);width=innerWidth;height=innerHeight;}document.silly.you.value=init_msg;ActualObj.backgroundColor=document.bgColor;}function give(){alert("And how did you come with that? Thats against the rules. Use the damn mouse");kb='True';}function done(){if (kb != 'True')  {alert("You did it!");kb='False'}}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onload=start()><DIV id=floatLyr onmouseover=go_diff() style="LEFT: 40px; VISIBILITY: visible; POSITION: absolute; TOP: 40px; width: auto; height: auto;"><FORM name=silly><TABLE width=100 border=0>  <TBODY>  <TR>    <TD vAlign=center align=middle><INPUT onkeypress=give() onmousedown=done() onmouseover=go_diff() style="FONT-SIZE: 9pt; FONT-FAMILY: ms sans serif" type=button name=you></TD></TR></TBODY></TABLE></FORM></DIV></BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->