HTML - 点击一次即可打开2页 [英] HTML - On one click open 2 pages

查看:106
本文介绍了HTML - 点击一次即可打开2页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要这样做:



我有一段文字。当我点击它时,我必须打开2页。这里没问题......但诀窍是我不允许使用js。所以......你只能用html做到这一点吗?

解决方案

如果没有JavaScript,就不可能通过单击一个链接来打开两个页面,除非这两个页面在打开的页面从点击链接。使用JS,它是微不足道的:

 < p>< a href =#onclick =window.open('http ://google.com'); 
window.open('http://yahoo.com');>点击打开Goog​​le和Yahoo< / a>< / p>

请注意,这会被内置于网页浏览器的弹出式窗口拦截器阻止,但您通常会收到此通知。


Good day to all.

I need to do this:

I have a text. When I click on it I must open 2 pages. No problem here... but the trick is that I am not allowed to use js. So... can you do this only with html?

解决方案

Without JavaScript, it's not possible to open two pages by clicking one link unless both pages are framed on the one page that opens from clicking the link. With JS it's trivial:

<p><a href="#" onclick="window.open('http://google.com');
    window.open('http://yahoo.com');">Click to open Google and Yahoo</a></p>

Do note that this will be blocked by popup blockers built into web browsers but you are usually notified of this.

这篇关于HTML - 点击一次即可打开2页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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