超链接可以调用Javascript确认提示吗? [英] Can a Hyperlink call a Javascript confirm prompt?

查看:72
本文介绍了超链接可以调用Javascript确认提示吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个JavaScript,如果用户点击一张大图片中的

超链接热点,我只想发生这种情况:


< ; script type =" text / javascript">

<! -

var answer = confirm("此链接不可用,单击确定加载a

类似的链接,或者取消给不。)

如果(!回答)

window.location =" http:/ /www.yahoo.com/"

// - >

< / script>


制作更具挑战性的是,图片中有大约10个热点,

我希望每个热点都有不同的window.location值。即如果

用户在每个热点点击OK,每个热点都会将它们重定向到一个

不同的网站。


任何聪明的 - 堵在那里谁可以帮帮忙? :)


提前致谢。

解决方案

Chris Ianson写道:

我有这个JavaScript,我只想发生


可能你的意思是执行。

如果用户点击在大图像中的超链接热点:

< script type =" text / javascript">
<! -
^^^^

废话。

var answer = confirm(此链接不可用,单击确定以加载
类似链接,或取消不。)




完全无稽之谈。那些没有客户端脚本支持的用户呢?如果您发现链接不起作用,请将其删除(链接,不一定是其内容的b $ b)。如果你想解决断开的链接,直到你有时间来修复它们(某种方式),那就做那个服务器端,而不是(只)

客户端-b。


并停止交叉到alt。*和Big Eight(包括comp。*)。

PointedEars


任何想法的家伙?


" Chris Ianson" <无*** @ hotmail.com>在留言中写道

news:v2 ***************** @ text.news.blueyonder.co.u k ...

我有这个JavaScript,如果用户点击大图像中的超链接热点,我只想发生这种情况:

< script type =" text / javascript">
<! -
var answer = confirm(此链接不可用,请点击确定以加载
类似的链接,或取消。)
如果(!回答)
window.location =" http://www.yahoo.com/"
// - >
< / script>

为了使问题更具挑战性,
图像中有大约10个热点,我希望它们各自具有不同的window.location值。
即如果用户在每个热点中单击确定,则每个热点都会将其重定向到另一个站点。

任何聪明的堵塞都可以提供帮助吗? :)

提前致谢。





" Chris Ianson" <无*** @ hotmail.com>在留言中写道

news:v2 ***************** @ text.news.blueyonder.co.u k ...

我有这个JavaScript,如果用户点击大图像中的超链接热点,我只想发生这种情况:

< script type =" text / javascript">
<! -
var answer = confirm(此链接不可用,请点击确定以加载
类似的链接,或取消。)
如果(!回答)
window.location =" http://www.yahoo.com/"
// - >
< / script>

为了使问题更具挑战性,
图像中有大约10个热点,我希望它们各自具有不同的window.location值。
即如果用户在每个热点中单击确定,则每个热点都会将其重定向到另一个站点。

任何聪明的堵塞都可以提供帮助吗? :)

提前致谢。




尝试设置href =" http://www.yahoo.com/"和onClick ="返回确认(你真的想要雅虎吗?)这是


Hi, I have this JavaScript, which I only want to occur if a user clicks on a
hyperlink hotspot in a large image:

<script type="text/javascript">
<!--
var answer = confirm ("This link is not available, click OK to load a
similar link, or Cancel to not.")
if (!answer)
window.location="http://www.yahoo.com/"
// -->
</script>

To make matters more challenging, there are about 10 hotspots in the image,
and I want them each to have a different value for window.location. I.e. if
the user clicks OK in each hotspot, each one will redirect them to a
different site.

Any clever-clogs out there who can help out? :)

Thanks in advance.

解决方案

Chris Ianson wrote:

Hi, I have this JavaScript, which I only want to occur
Probably you mean "execute".
if a user clicks on a hyperlink hotspot in a large image:

<script type="text/javascript">
<!-- ^^^^
Nonsense.
var answer = confirm ("This link is not available, click OK to load a
similar link, or Cancel to not.")



Utter nonsense. What about users without client-side script support? If you
discover that a link does not work, remove it (the link, not necessarily
its content). If you want to work around broken links until you have time
to fix them (one way or the other), do that server-side, not (only)
client-side.

And stop crossposting to alt.* and the Big Eight (incl. comp.*).
PointedEars


Any ideas guys?

"Chris Ianson" <no***@hotmail.com> wrote in message
news:v2*****************@text.news.blueyonder.co.u k...

Hi, I have this JavaScript, which I only want to occur if a user clicks on
a hyperlink hotspot in a large image:

<script type="text/javascript">
<!--
var answer = confirm ("This link is not available, click OK to load a
similar link, or Cancel to not.")
if (!answer)
window.location="http://www.yahoo.com/"
// -->
</script>

To make matters more challenging, there are about 10 hotspots in the
image, and I want them each to have a different value for window.location.
I.e. if the user clicks OK in each hotspot, each one will redirect them to
a different site.

Any clever-clogs out there who can help out? :)

Thanks in advance.




"Chris Ianson" <no***@hotmail.com> wrote in message
news:v2*****************@text.news.blueyonder.co.u k...

Hi, I have this JavaScript, which I only want to occur if a user clicks on
a hyperlink hotspot in a large image:

<script type="text/javascript">
<!--
var answer = confirm ("This link is not available, click OK to load a
similar link, or Cancel to not.")
if (!answer)
window.location="http://www.yahoo.com/"
// -->
</script>

To make matters more challenging, there are about 10 hotspots in the
image, and I want them each to have a different value for window.location.
I.e. if the user clicks OK in each hotspot, each one will redirect them to
a different site.

Any clever-clogs out there who can help out? :)

Thanks in advance.



Try setting the href="http://www.yahoo.com/" and onClick="return confirm("Do
you really want Yahoo?'')"


这篇关于超链接可以调用Javascript确认提示吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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