right click script

K

kelly

How do I add sound to a right click script insted of a
message. Here what I have for a script it dont let you
copy or save as. The message thanks for looking apears. I
would like NOT to have a message just a sound something I
can record my self.

<script LANGUAGE="JavaScript">
function click(){
if (event.button==2){
alert('THANKS FOR LOOKING!');
}
}
document.onmousedown=click
// -->
</script>
 
J

Jim Cheshire

Before you go to all of that trouble, you might want to check this out:

http://www.jimcoaddins.com/protect.htm

--
Jim Cheshire
Jimco
http://www.jimcoaddins.com
================================
Author of Special Edition
Using Microsoft Office FrontPage 2003
5 Stars on Amazon and B&N
================================
The opinions expressed by me in the
newsgroups are my own opinions and
are in no way associated with my
employer or any other party. Jimco is
not associated in any way with any other
entity.
 
J

Jim Buyens

You realize, of course, that:

o Anyone who wants to copy something out of your Web
page can do so by pressing Alt-PrtSc and then
pasting into another program.
o Anyone who wants a copy of your file can:
o Find it in their browser cache, or
o View your HTML, get the content URL, paste that
URL into the browser's address bar, and then choose
Save As from the browser's File menu.

The bottom line is that really, if the visitor's computer
can download content for viewing, there's *always* a way
for the visitor to save it.

If you want to close down as many leaks as you can and
hope the visitors don't know about the rest, I suppose
that's a strategy. But most designers consider it a false
sense of security.

If you don't want people stealing your content, don't put
it on the Web. Just show teasers.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
K

Kevin Spencer

Mike,

I assume you know that the principle is the same? It is simply not possible
to protect your HTML code from being viewed, any more than it is possible to
protect images from being copied, for the exact same reasons. And disabling
right-click is an amateur trick that drives people away from your site.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
M

MD Websunlimited

Sure I do but Kelly asked how to play a sound file when something was right clicked. Nothing about protecting an image, which I
believe is assumed here.

Note, you can let the normal action of the right click continue to bubble through the event path and get the context menu.


--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
Need to run ASP pages without a browser or server? Take a look at what RunASP can do for you.
http://www.websunlimited.com/order/Product/RunASP/runasp.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible
 
M

MD Websunlimited

J

Jim Cheshire

Just takes a quick glance at his script. If you know JavaScript, you'll
know what he's trying to do.

--
Jim Cheshire
Jimco
http://www.jimcoaddins.com
================================
Author of Special Edition
Using Microsoft Office FrontPage 2003
5 Stars on Amazon and B&N
================================
The opinions expressed by me in the
newsgroups are my own opinions and
are in no way associated with my
employer or any other party. Jimco is
not associated in any way with any other
entity.



MD Websunlimited said:
Is everyone here reading or seeing something I'm not? There are valid
reason to use right click other than to stop the context menu.
 
J

Jim Buyens

The original question was:
How do I add sound to a right click script insted of a
message. Here what I have for a script it dont let you
copy or save as. The message thanks for looking apears. I
would like NOT to have a message just a sound something I
can record my self.

The wording on this is a little rough, but it seemed to me
that the poster was trying to stop use of the Copy or Save As
commands.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
K

kelly

Forget the protect image if that is a bad idea. But how
can I play a sound if something is right clicked on.
useing IE
 
K

Kevin Spencer

I think we all got confused - it sounds like there were actually 2 separate
questions involved.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

MD Websunlimited said:
Is everyone here reading or seeing something I'm not? There are valid
reason to use right click other than to stop the context menu.
 
J

Jim Cheshire

I didn't get confused. He posted the script he was using. It was clearly a
script to stop the context menu. His question was how to add his voice
instead of the text message. :)

--
Jim Cheshire
Jimco
http://www.jimcoaddins.com
================================
Author of Special Edition
Using Microsoft Office FrontPage 2003
5 Stars on Amazon and B&N
================================
The opinions expressed by me in the
newsgroups are my own opinions and
are in no way associated with my
employer or any other party. Jimco is
not associated in any way with any other
entity.
 
K

Kevin Spencer

Well, that could be considered 2 questions (1 - stop right-click, 2 - use
voice to alert). I believe that's where the confusion came in. Some were
addressing number 1 and some were addressing number 2.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
J

Jim Buyens

kelly said:
Forget the protect image if that is a bad idea. But how
can I play a sound if something is right clicked on.
useing IE

Well, OK, here's a page that does what you want.

<html>
<head>
<title>Play Sound On Right-Click</title>
<script language="JavaScript">
<!--
function playSound(path) {//v1.0
var b;
var d=document;
var e;
var es;
var i;
var se="<EMBED SRC='"+path+"' HIDDEN=TRUE LOOP=FALSE
AUTOSTART=TRUE>";
if(d.body)b=d.body;
if(d.getElementsByTagName) {
es=d.getElementsByTagName('embed')
for(i=0; i<es.length; i++) {
e=es(i);
if( e.src==path ) {
if(e.removeNode) e.removeNode();
break;
}
}
if(b&&b.insertAdjacentHTML) b.insertAdjacentHTML("beforeend",se);
}
}
function ckhRightClick(){
if (event.button==2){
playSound('../images/ringout.wav');
}
}
document.onmousedown=ckhRightClick;
// -->
</script>
</head>
<body>
<p>Play Sound</p>
</body>
</html>

This methjod of playing a sounds seems a little strange, but it's what
FP2003 generates when you use the Behaviors feature to play a sound.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top