View Full Version : how can I have the right mouseclick go to
justsexxx
01-30-2002, 04:06 PM
Hi,
how can I have the right mouseclick go to a site.
I know I can disable the right mouse, or even let it bookmark my site. But is it also possible to let the right mouse click go to a site?
Andre
richard
01-30-2002, 04:14 PM
edit the function that it points to, to say "location.href=$url"
justsexxx
01-30-2002, 04:37 PM
mmm but for bookmakr it's in a javascript...WIth other functions I think. But I will try this
Andre
justsexxx
01-30-2002, 04:40 PM
MMm, I'm to stupid for it.
Here is the code for bookmakr, any idea for urls now?
<SCRIPT language=JavaScript>
<!--
var url="http://www.domain.com";
var name="domain is da best";
function click(e) {
if (document.all) { if (event.button == 2) { window.external.AddFavorite(url,name); return false; } }
if (document.layers) {if (e.which == 3) { alert(message); return false; } }
}
if (document.layers) { document.captureEvents(Event.MOUSEDOWN); }
document.onmousedown=click;
//-->
</SCRIPT>
thorn
01-30-2002, 07:55 PM
Here's a script that works for me.. Just change the url and statements..
<SCRIPT>
<!--
document.write(unescape("%3CSCRIPT%20LANGUAGE%3D%22JavaScript%22%3E%0D%0Afu nction%20click%28e%29%20%7B%0D%0Aif%20%28document. all%29%20%7B%0D%0Aif%20%28event.button%20%3D%3D%20 2%29% 20%7B%0D%0Aalert%28%27%20Watch%20This%20Sweetie%20 Suck%20A%20Dick%20Dry%21%20%27%29%3B%0D%0Atop.loca tion%3D%22http%3A//www.maximumcash.com/cgi-bin/maxcash.cgi?id=trevue&ps=ntteens% 3FID%3D9243286%22%3B%0D%0Areturn%20false%3B%0D%0A% 7D%0D%0A%7D%0D%0A%0D%0Aif%20%28document.layers%29% 20%7B%0D%0Aif%20%28e.which%20%3D%3D%203%29%20%7B%0 D%0Atop.location%3D%22http%3A/ /www.erasercash.com/wm.html%3FID%3D9243286%22%3B%0D%0Areturn%20false%3 B%0D%0A%7D%0D%0A%7D%0D%0A%7D%0D%0A%0D%0Aif%20%28do cument.layers%29%20%7B%0D%0Adocument.captureEvents %28Event.M OUSEDOWN%29%3B%0D%0A%7D%0D%0Adocument.onmousedown% 3Dclick%3B%0D%0A%0D%0A%3C/SCRIPT%3E"));
//-->
</SCRIPT>
justsexxx
01-31-2002, 12:43 AM
Hi,
This code willw not work. Can you pls add it in the code tag?
{code} {/code} change { to [ thnx a lot
Andre
dline8
01-31-2002, 01:20 AM
You could try this:
<SCRIPT LANGUAGE="Javascript"><!--
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
var EnableRightClick = 0;
if(isNS)
document.captureEvents(Event.MOUSEDOWN||Event.MOUS EUP);
function mischandler(){
if(EnableRightClick==1){ return true; }
else {return false; }
}
function mousehandler(e){
if(EnableRightClick==1){ return true; }
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) open("http://www.where-you-want-to-send-the-surfer.com");return false;
}
function keyhandler(e) {
var myevent = (isNS) ? e : window.event;
if (myevent.keyCode==96)
EnableRightClick = 1;
return;
}
document.oncontextmenu = mischandler;
document.onkeypress = keyhandler;
document.onmousedown = mousehandler;
//-->
</script>
This is a variation of a script I found online, not something I wrote from scratch, so I take no credit for it. I tested it in IE and Netscape and it works for both. You may need to tweak it a bit, but at least it's a start...
justsexxx
01-31-2002, 04:20 AM
Huh?
I added this script in a head of the testpage and it didn't work for me. Not in IE6.0 and Netscape 6.2 ....
Very strange. I added this code simply to a blank page. I added html tags en head body etc. But it still did'nt work...Any idea what I'm doing wrong?>
Andre
dline8
01-31-2002, 08:22 AM
Did you put the code in your web page so that it looks EXACTLY like the way I posted it? I tried to copy & paste and noticed that the code ended up in one big, ugly-ass line that didn't work when I tried it, either. I put the code in the same format (line breaks, etc.) as it is posted above and it worked. Maybe that's the problem? :)
dline8
01-31-2002, 08:39 AM
I uploaded a webpage with the script in it if you want to try it there:
TEST THE CODE HERE (http://www3.kinghost.com/teen/naughty/test/index.html)
justsexxx
01-31-2002, 04:19 PM
It works,
Thnx a lot,
Andre
vBulletin® v3.7.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.