有什么方法可以将oncontextmenu和title值应用到所有图像? [英] Any way to apply oncontextmenu and title values to ALL images?

查看:79
本文介绍了有什么方法可以将oncontextmenu和title值应用到所有图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,快点吧。我希望有人有答案。


我们在一个页面上有大约30张图片,并希望将这样的内容应用到

所有这些:


< ... oncontextmenu =" alert(''Message here。''); return false;" title ="这里的另一个

消息。 ...>


我们希望将相同的东西复制到每个图像,这基本上会使重复的长代码需要更多的时间来加载。


是否有一种简单的方法可以在代码中出现一次,但是将

本身应用于页面中的所有图像?

-

谢谢,




试试Google Quik-e-search?在 www.Superhighstreet.com/home

.. ..找到任何东西或他们为你买它!

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?
--
Thanks,
Me

Try Google Quik-e-search? at www.Superhighstreet.com/home
....Finds anything or they buy it for you!

推荐答案

Chris Tomlinson写道:
Chris Tomlinson wrote:

大家好,只是一个快速。我希望有人有答案。


我们在一个页面上有大约30张图片,并希望将这样的内容应用到

所有这些:


< ... oncontextmenu =" alert(''Message here。''); return false;" title ="这里的另一个

消息。 ...>


我们希望将相同的东西复制到每个图像,这基本上会使重复的长代码需要更多的时间来加载。


是否有一种简单的方法可以在代码中出现一次,但是将

本身应用于页面中的所有图像?
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?



如果你想将它应用于图像_after_loading页面,你需要使用JavaScript。我猜你还是不相信这个

*可能会成为一个问题,因为很多用户关掉了它,所以它b / b
应该不是问题使用它。但恕我直言,删除HTML代码的片段以便更快地加载它并使用

a JS这需要一些时间来加载......这是非常荒谬的。

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...


Chris Tomlinson写道:
Chris Tomlinson wrote:

我们在页面上有大约30张图片,想要应用类似的东西这一切为

所有这些:


< ... oncontextmenu =" alert(''Message here。''); return false;" title ="这里的另一个

消息。 ...>
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." ... >



使用子程序,而不是内联代码的页面。


编写上下文智能的子程序,即它们可以告诉

哪个事件和DOM节点触发它们并作出相应的反应,它们

不需要通过内联传入一个数千的参数

事件处理程序调用。


使用事件监听器。


阅读任何有关现代JavaScript技术的现代书籍(可能是一个

关于AJAX的喋喋不休)

Use subroutines, not pages of inline code.

Write subroutines that are context-intelligent, i.e. they can tell
which event and DOM node triggered them and react accordingly, they
don''t have to have a squillion parameters passed in through the inline
event handler call.

Use event listeners.

Read any modern book on modern JavaScript techniques (probably one
blathering about AJAX too)


" jojo" < jo ********* @ gmx.dewrote in message

news:ea ********** @ registered.motzarella.org ...
"jojo" <jo*********@gmx.dewrote in message
news:ea**********@registered.motzarella.org...

Chris Tomlinson写道:
Chris Tomlinson wrote:

>大家好,只是一个快速。我希望有人有答案。

我们在一个页面上有大约30张图片,并希望对所有这些图像应用这样的内容:

< ... oncontextmenu =" alert(''Message here。''); return false;" title ="这里的另一个
消息。 ...>

我们希望将相同的内容复制到每个图像中,这基本上会使重复的长代码需要更多的时间来加载。

是否有一种简单的方法可以在代码中出现一次,但是将
本身应用于页面中的所有图像?
>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?



如果你想将它应用于图像_after_loading页面你需要使用JavaScript。我猜你还是不相信这个*可能*

是一个问题,因为很多用户关掉了它,所以它不应该是一个问题。使用它。但恕我直言,删除HTML代码的片段以便更快地加载它并应用一个需要

一段时间加载的JS,这简直太荒谬了。 。


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...



谢谢,但是如果我确实想要使用JS我会注意到FF浏览器无视它还是

并且允许右键单击,所以理想情况下我希望只有HTML。我猜这是不可能的,但是如果我错了就告诉我。谢谢。


-

谢谢,




www.Superhighstreet.com/home

....找到任何东西或者他们为你买它!

Thanks, but if I did want to use JS I notice FF browser ignores it anyway
and allows right-click, so ideally I was hoping for something HTML only. I
guess it''s not possible but let me know if I''m wrong, thanks.

--
Thanks,
Me

Try Google Quik-e-searchT at www.Superhighstreet.com/home
....Finds anything or they buy it for you!


这篇关于有什么方法可以将oncontextmenu和title值应用到所有图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆