|
Posted by Randy Webb on 07/24/06 19:22
Chris Tomlinson posted the following to news:comp.lang.javascrit on
7/24/2006 1:33 PM:
[follow-up set to comp.lang.javascript]
> "jojo" <jojo.hafner@gmx.de> wrote in message
> news:ea2qin$h68$1@registered.motzarella.org...
>> Chris Tomlinson wrote:
>>
>>> Hi all, just a quickie. I hope someone has the answer.
>>>
>>> We have about 30 images on a page, and want to apply something like this
>>> to all of them:
>>>
>>> < ... oncontextmenu="alert('Message here.');return false;" title="Another
>>> message here." ... >
>>>
>>> We want the same thing copied to every image, which basically makes for
>>> repetitive, long code that takes more time to load.
>>>
>>> Is there an easy way to have this appear just once in the code, but apply
>>> itself to all images in the page?
>> If you want to have it applied to the images _after_loading the page you
>> have to use JavaScript. I guess you still won't believe that this *might*
>> be a problem because many users have it switched off, so it shouldn't be a
>> problem to use it. But IMHO it's just ridiculous to strip out snippets of
>> the HTML code to get it loaded more quickly and applying a JS which takes
>> some time to load...
>
> Thanks, but if I did want to use JS I notice FF browser ignores it anyway
> and allows right-click,
That's because FF ignores the oncontextmenu, whether initiated by script
or by HTML code.
> so ideally I was hoping for something HTML only.
It still won't do what you want, test it in Opera.
> I guess it's not possible but let me know if I'm wrong, thanks.
You aren't wrong, it's impossible to reliably change the contextmenu.
Guess: You don't want your images copied and you think this is the way
to do that.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Navigation:
[Reply to this message]
|