如何避免使用shift键打开新窗口? [英] How to avoid opening a new window with the shift key?

查看:89
本文介绍了如何避免使用shift键打开新窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。


我有问题。当你按下Shift键并点击

鼠标的左键时,我想避免打开一个新窗口。我已经尝试了下一个解决方案,在页面正文中我把

下一个代码:


< BODY onkeydown =''notOpenNewWindow( );''>

我写了这个javascript函数:


函数notOpenNewWindow(){

if(window。 event.keyCode ==''16''){

window.event.keyCode = 0;

window.event.returnValue = false;

}


但是这个解决方案错了,因为新窗口打开了。


有人可以帮助我吗?


谢谢,


Carlos。

解决方案

Carlos Andr?s写道:

大家好。

我遇到了问题。当你按下shift键并点击
鼠标的左键时,我想避免打开一个新窗口。我已经尝试了下一个解决方案,在页面正文中我把下一个代码:




然后重新设计你的页面以便它不会当它在一个新的窗口打开时打破。如果我右键单击并在在新窗口中打开会发生什么?


-

兰迪

机会有利于准备介意

comp.lang.javascript常见问题 - http://jibbering.com / faq /


文章< o4 ******************** @ comcast。 com>, hi************@aol.com

启发我们...

Carlos Andr?s写道:

大家好。
我遇到了问题。当你按下shift键并点击
鼠标的左键时,我想避免打开一个新窗口。我已经尝试了下一个解决方案,在页面正文中我把
下一个代码:



然后重新设计你的页面,这样它就不会破坏了它在一个新窗口中打开。如果我右键单击并在在新窗口中打开会发生什么?




当我在Mozilla或Opera中鼠标中键时会发生什么? ;)

(提示OP:我设置它以便鼠标点击鼠标左键打开新的

窗口中的链接)


-

-

~kaeli~

在日光浴时读书会让你感觉很红。
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


< BLOCKQUOTE>" kaeli"写了
hi ************ @ aol.com 用...启发我们

Carlos Andr?s写道:

我遇到了问题。当你按下shift键并点击
鼠标的左键时,我想避免打开一个新窗口。我已经尝试了下一个解决方案,在页面正文中我把
下一个代码:



然后重新设计你的页面,这样它就不会破坏了它在一个新窗口中打开。如果我右键单击并在在新窗口中打开会发生什么?



当我在Mozilla或Opera中点击鼠标时会发生什么? ;)
(提示OP:我设置它以便鼠标点击鼠标左键打开新窗口中的链接)




如果我按Ctrl-N?如果我对这些无用的

毫无意义的脚本感到非常恼火,我完全禁用脚本会怎么样?

设计你的页面以允许这些浏览器技巧,这就是网络的方式。

你没有告诉我们你认为你需要禁用它的原因,我的猜测

是因为它很弱和/或没有经过深思熟虑通过。

Amen,

Ivo。


Hi everybody.

I''ve got a problem. I''d like to avoid opening a new window when you
have pressed the shift key and you click in the left button of the
mouse. I''ve tried the next solution, in the body of the page I put the
next code:

<BODY onkeydown=''notOpenNewWindow();''>
And I wrote this javascript function:

function notOpenNewWindow(){
if (window.event.keyCode==''16''){
window.event.keyCode = 0;
window.event.returnValue = false;
}

But this solution is wrong because the new window is opened.

Could anybody help me?

Thanks,

Carlos.

解决方案

Carlos Andr?s wrote:

Hi everybody.

I''ve got a problem. I''d like to avoid opening a new window when you
have pressed the shift key and you click in the left button of the
mouse. I''ve tried the next solution, in the body of the page I put the
next code:



Then redesign your page so that it doesn''t break when its opened in a
new window. What happens if I right click and "Open in new window"?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/


In article <o4********************@comcast.com>, hi************@aol.com
enlightened us with...

Carlos Andr?s wrote:

Hi everybody.

I''ve got a problem. I''d like to avoid opening a new window when you
have pressed the shift key and you click in the left button of the
mouse. I''ve tried the next solution, in the body of the page I put the
next code:



Then redesign your page so that it doesn''t break when its opened in a
new window. What happens if I right click and "Open in new window"?



What happens when I middle mouse click in Mozilla or Opera? ;)
(hint to OP: I set it up so middle mouse click opens links in a new
window)

--
--
~kaeli~
Reading while sunbathing makes you well red.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


"kaeli" wrote
hi************@aol.com enlightened us with...

Carlos Andr?s wrote:

I''ve got a problem. I''d like to avoid opening a new window when you
have pressed the shift key and you click in the left button of the
mouse. I''ve tried the next solution, in the body of the page I put the
next code:



Then redesign your page so that it doesn''t break when its opened in a
new window. What happens if I right click and "Open in new window"?



What happens when I middle mouse click in Mozilla or Opera? ;)
(hint to OP: I set it up so middle mouse click opens links in a new
window)



And what if I press Ctrl-N? And what if I get so annoyed by these clueless
pointless scripts that I disable script altogether?
Design your page to allow these browser tricks, that is the way of the web.
You don''t give us the reason you think you need to do disable this, my guess
is because it ''s weak and/or not well thought through.
Amen,
Ivo.


这篇关于如何避免使用shift键打开新窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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