Click to See Complete Forum and Search --> : Small Help on Oning back Right Click


oyama
08-08-2004, 11:30 AM
Hi people, I dont know if this is the correct place to post this, sorry if its wrong.
Heres the problem I need help with. My website can "Right click" at 1st, after I enter the script below, the right click is disabled, how to on it back ? Or is there some code that can be erased ? The script is a game actually, from http://javascript.internet.com/games/mind-reader.html


<!-- TWO STEPS TO INSTALL MIND READER:

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<!-- Begin
var cards = new Array(6);
var play = 0;
var cn = 0;
var ttl = 0;
cards[1] = " CARD ONE \n 1 3 5 7 9 11 13 15 \n 17 19 21 23 25 27 29 31 \n 33 35 37 39 41 43 45 47 \n 49 51 53 55 57 59 61 63";
cards[2] = " CARD TWO \n 2 3 6 7 10 11 14 15 \n 18 19 22 23 26 27 30 31 \n 34 35 38 39 42 43 46 47 \n 50 51 54 55 58 59 62 63";
cards[3] = " CARD THREE \n 4 5 6 7 12 13 14 15 \n 20 21 22 23 28 29 30 31 \n 36 37 38 39 44 45 46 47 \n 52 53 54 55 60 61 62 63";
cards[4] = " CARD FOUR \n 8 9 10 11 12 13 14 15 \n 24 25 26 27 28 29 30 31 \n 40 41 42 43 44 45 46 47 \n 56 57 58 59 60 61 62 63";
cards[5] = " CARD FIVE \n 16 17 18 19 20 21 22 23 \n 24 25 26 27 28 29 30 31 \n 48 49 50 51 52 53 54 55 \n 56 57 58 59 60 61 62 63";
cards[6] = " CARD SIX \n 32 33 34 35 36 37 38 39 \n 40 41 42 43 44 45 46 47 \n 48 49 50 51 52 53 54 55 \n 56 57 58 59 60 61 62 63";
var ccol = new Array("","#FF7777","Green","Blue","Gray","Red","Black");
var knos = new Array("",1,2,4,8,16,32);
function Nextcard() {
cn++;
if(cn == 7)
End();
else {
document.x.card.value=cards[cn];
document.x.card.style.backgroundColor=ccol[cn];
document.x.text.value="Is your number on the card above?";
}
}
function Restart() {
play=0;
cn=0;
ttl=0;
document.x.card.style.backgroundColor = "#FFFFFF";
document.x.card.style.color = "#000000";
document.x.card.value = "Think of a number between 1 and 63. Six cards will be displayed. After the last one, your number is revealed.";
document.x.text.value = "Click Start";
document.x.stbt.value = "Start";
}
function Yes() {
ttl = ttl + knos[cn];
Nextcard();
}
function Start() {
document.x.card.style.color = "White";
document.x.stbt.value = "Restart";
play = 1;
Nextcard();
}
function End() {
play = 2;
if(ttl < 10)
ttl = " " + ttl;
ttl = " " + ttl;
var one = ttl.charAt(1);
var two = ttl.charAt(2);
document.x.card.value = "\n THE NUMBER YOU WERE \n THINKING OF WAS : \n -- [ "+one+" "+two+" ] --";
document.x.card.style.color = "Red";
document.x.text.value = "Click Restart to play again";
}
function click() {
event.cancelBubble = true;
event.returnValue = false;
}
document.oncontextmenu = click;
// End -->
</script>

</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>

<form name="x">
<center>
<table border="0">
<tr>
<td>
<center>
<textarea name="card" rows="5" cols="25">Think of a number between 1 and 63. Six cards will be displayed. After the last one, your number is revealed.
</textarea>
</center>
</td>
</tr>
<tr>
<td>
<center>
<input type="text" size="36" name="text" value="Click Start" style="FONT-SIZE: 8pt">
</center>
</td>
</tr>
<tr>
<td>
<center>
<input type="button" value="YES" onclick="if(play==1) Yes()" style="FONT-SIZE: 8pt">
<input type="button" value="NO" onclick="if(play==1) Nextcard()" style="FONT-SIZE: 8pt">
<input type="button" name="stbt" value=" Start " onclick="if(play==0) Start(); else Restart()" style="FONT-SIZE: 8pt">
</center>
</td>
</tr>
</table>
</center>
</form>

Pittimann
08-08-2004, 12:09 PM
Hi!

Sorry for the waste of server capacities, but like that it is easier for me to give an example:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
var cards = new Array(6);
var play = 0;
var cn = 0;
var ttl = 0;
cards[1] = " CARD ONE \n 1 3 5 7 9 11 13 15 \n 17 19 21 23 25 27 29 31 \n 33 35 37 39 41 43 45 47 \n 49 51 53 55 57 59 61 63";
cards[2] = " CARD TWO \n 2 3 6 7 10 11 14 15 \n 18 19 22 23 26 27 30 31 \n 34 35 38 39 42 43 46 47 \n 50 51 54 55 58 59 62 63";
cards[3] = " CARD THREE \n 4 5 6 7 12 13 14 15 \n 20 21 22 23 28 29 30 31 \n 36 37 38 39 44 45 46 47 \n 52 53 54 55 60 61 62 63";
cards[4] = " CARD FOUR \n 8 9 10 11 12 13 14 15 \n 24 25 26 27 28 29 30 31 \n 40 41 42 43 44 45 46 47 \n 56 57 58 59 60 61 62 63";
cards[5] = " CARD FIVE \n 16 17 18 19 20 21 22 23 \n 24 25 26 27 28 29 30 31 \n 48 49 50 51 52 53 54 55 \n 56 57 58 59 60 61 62 63";
cards[6] = " CARD SIX \n 32 33 34 35 36 37 38 39 \n 40 41 42 43 44 45 46 47 \n 48 49 50 51 52 53 54 55 \n 56 57 58 59 60 61 62 63";
var ccol = new Array("","#FF7777","Green","Blue","Gray","Red","Black");
var knos = new Array("",1,2,4,8,16,32);
function Nextcard() {
cn++;
if(cn == 7)
End();
else {
document.x.card.value=cards[cn];
document.x.card.style.backgroundColor=ccol[cn];
document.x.text.value="Is your number on the card above?";
}
}
function Restart() {
play=0;
cn=0;
ttl=0;
document.x.card.style.backgroundColor = "#FFFFFF";
document.x.card.style.color = "#000000";
document.x.card.value = "Think of a number between 1 and 63. Six cards will be displayed. After the last one, your number is revealed.";
document.x.text.value = "Click Start";
document.x.stbt.value = "Start";
}
function Yes() {
ttl = ttl + knos[cn];
Nextcard();
}
function Start() {
document.x.card.style.color = "White";
document.x.stbt.value = "Restart";
play = 1;
Nextcard();
}
function End() {
play = 2;
if(ttl < 10)
ttl = " " + ttl;
ttl = " " + ttl;
var one = ttl.charAt(1);
var two = ttl.charAt(2);
document.x.card.value = "\n THE NUMBER YOU WERE \n THINKING OF WAS : \n -- [ "+one+" "+two+" ] --";
document.x.card.style.color = "Red";
document.x.text.value = "Click Restart to play again";
}
function click() {
event.cancelBubble = true;
event.returnValue = false;
}
document.oncontextmenu = click;
function restoreRC(){
document.oncontextmenu=function(){return true};
}
//-->
</script>
</head>
<body>
<form name="x">
<center>
<table border="0">
<tr>
<td>
<center>
<textarea name="card" rows="5" cols="25">Think of a number between 1 and 63. Six cards will be displayed. After the last one, your number is revealed.
</textarea>
</center>
</td>
</tr>
<tr>
<td>
<center>
<input type="text" size="36" name="text" value="Click Start" style="FONT-SIZE: 8pt">
</center>
</td>
</tr>
<tr>
<td>
<center>
<input type="button" value="YES" onclick="if(play==1) Yes()" style="FONT-SIZE: 8pt">
<input type="button" value="NO" onclick="if(play==1) Nextcard()" style="FONT-SIZE: 8pt">
<input type="button" name="stbt" value=" Start " onclick="if(play==0) Start(); else Restart()" style="FONT-SIZE: 8pt">
<input type="button" name="stopit" value=" End game (and let me right click again)" onclick="restoreRC()" style="FONT-SIZE: 8pt">
</center>
</td>
</tr>
</table>
</center>
</form>
</body>
</html>But: why the hell you need the right click disabled first and then bring it back????? Or is it just the script which does it and you don't know how not to disable it?

Cheers - Pit

oyama
08-08-2004, 12:11 PM
yea the script auto did it for me, and I dont know how to on it back
=( , think you can help me out ? maybe i can change the code a lil or something i dont know .. hmm..

Pittimann
08-08-2004, 12:16 PM
Hi!

If you use the code I posted and press the odd button which I added, the right click will come back.

If you agree with not disabling the right click by that script, just delete the last lines in the javascript, you originally posted:
******
function click() {
event.cancelBubble = true;
event.returnValue = false;
}
document.oncontextmenu = click;
******

Just an advice: delete these lines and don't worry about bringing the click back - it's of no use to disable it. Particularly if you want to bring it back later.

Regards - Pit

oyama
08-08-2004, 12:31 PM
HEY GREAT, i added your codes, and i deleted this line

<input type="button" name="stopit" value=" End game (and let me right click again)" onclick="restoreRC()"

its back to the original and just that the right click is abled.
right ?

Pittimann
08-08-2004, 12:33 PM
Hi!

Using your code (not what I posted first) and deleting the lines, I mentioned later, leads to this nice effect: right click will not be disabled from the start. And that is GOOD! :p

Regards - Pit

oyama
08-08-2004, 12:38 PM
so you meant, to delete those lines from the codes i posted ?
those lines are not in the codes i posted i believe ?
haha sorry im pretty lost here =x

wat i did was - use your code, delete the 5 lines and delete the extra line. is that correct ?

Pittimann
08-08-2004, 12:46 PM
Hi!

The lines I told you to better delete were in the first post you sent.

They are above this:
*****
// End -->
</script>

</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>
*****

But I believe, you already did, what I wanted to advise you to do:
delete these lines and my extra stuff.

Cheers - Pit

oyama
08-08-2004, 12:53 PM
oh I didnt realise those lines are in my codes.
so what u meant was to delete the 5 lines from the codes I posted right ? ok i get it i get it

Im so lucky to have met you, thankx a thousand dude !
Thx ALOT man .. ^_^

by the way, you know any sites with alot of java script games ?

Pittimann
08-08-2004, 12:57 PM
Hi!

Glad, you got it and you are welcome. :pby the way, you know any sites with alot of java script games ?I occasionally play with scripts, but I am not a gamer, sorry.

You could start a thread - well, where - in the coffee lounge and ask for such sites.

Good luck - Pit

oyama
08-08-2004, 12:58 PM
oh ok cool
hey still thx alot
i sure is lucky to have met you hehe
^_^

Pittimann
08-08-2004, 01:01 PM
Hi!

Good luck concerning the games!
And if ever you happen to find one disabling right click, post again.

We will eliminate that. :D

Regards - Pit

oyama
08-08-2004, 01:03 PM
alrite alrite, im glad i saw this forum
you are one of the helpers here ? hehe muz be good at these

Pittimann
08-08-2004, 01:07 PM
Hehe!im glad i saw this forum
you are one of the helpers here ?When I first saw these forums, I was glad too. I am sometimes helper and sometimes disturber, but in general, I am what you are: a member of these forums.

:) Pit

oyama
08-08-2004, 01:18 PM
haha thats cool. I can only be a guy asking for help haha
I suc at these =x

Pittimann
08-08-2004, 01:24 PM
Hi!I can only be a guy asking for help The same applies to me. I am learning a lot here.

Pit

oyama
08-08-2004, 01:27 PM
haha I may need some help again soon.
till then you take care aight. thanks alot again !

hmm i realised if i keep right clicking, another web page will appear, is it my computer or the website, a diff website appears everytime i right click few times at diff websites..hmm