popup只用firefox打开问题 [英] popup open problem only with firefox

查看:50
本文介绍了popup只用firefox打开问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




i有这个问题:


有时,我无法重现,如果我点击一个小图片

网站,弹出_AND_另一个选项卡在firefox中打开。


以下是链接代码:


< div align =" center">

< a href =" / screenshot?show = p4_7ghz_memesama_big.jpg"

onclick =" popup(this ,850,800);返回false target =" _blank">< img

class =" newspic_click" SRC =" /newspics/p4_7ghz_memesama.jpg" alt =" Bild"

title =" Zum vergr ?? ern klicken">< / a>

< / div>


在哪里? http://www.tweakpc.de/?news_id=8100 此处例如


为什么会发生这种情况?我已经尝试了很多,但没有任何作用。


-

Markus K.

解决方案

Markus写道:



我有这个问题:

有时,我可以''重现,如果我点击
网站上的一个小图片,弹出_AND_另一个选项卡在firefox中打开。


你的代码在我的FF中(我允许打开弹出窗口从链接发送)

打开两个新的空白页面......! (没有其他标签)

一个裸体和一个完整的

这是链接代码:

< div align =" center"> ;
< a href =" / screenshot?show = p4_7ghz_memesama_big.jpg"
onclick =" popup(this,850,800);返回false target =" _blank">< img
class =" newspic_click" SRC =" /newspics/p4_7ghz_memesama.jpg" alt =" Bild"
title =" Zum vergr ?? ern klicken">< / a>
< / div>


你的函数popup()究竟是什么?

函数popup()的''this'是什么:

onclick =" popup(this,850,800); ?

在哪里? http://www.tweakpc.de/?news_id=8100 此处例如

为什么会发生这种情况?我已经尝试了很多,但没有任何作用。




函数弹出窗口(lnk,wiz,higt){

here = window.open( lnk.href,''here'',''width =''+ wiz +'',height =''+ higt +'',resizable = 1'');

// - ---------------------- ^ ---- ^这里=目标

}


< a href =" big.jpg"目标= QUOT;此处" onclick =" popup(this,850,screen.height-40)"


将打开一个新的裸窗口链接中的页面目标

与链接中调用的名称相同(target - >''here'')

所以......不需要''返回false''


如果JS被禁用,那将打开一个空白的标准窗口


如果在FF中禁用弹出窗口,我希望它会打开一个新标签...(?)


-

Stephane Moriaux et son [moins] vieux Mac


ASM写道:

你的代码在我的FF中(我允许打开弹出窗口从链接发送)
打开两个新的空白页面......! (并没有其他标签)
一个裸体和一个完整的


您是否检查过我在第一个条目中发布的链接?有一个小图像可以通过点击图片放大链接到

a新闻。

你的电脑上发生了什么?

以下是链接代码:

< div align =" center">
< a href =" / screenshot?show = p4_7ghz_memesama_big.jpg"
onclick =" popup(this,850,800);返回false target =" _blank">< img
class =" newspic_click" SRC =" /newspics/p4_7ghz_memesama.jpg" alt =" Bild"
title =" Zum vergr ?? ern klicken">< / a>
< / div>



什么确实你的函数popup()?
函数popup()的'this'是什么:
onclick =" popup(this,850,800); ?




ok我忘了插入孔脚本。这是:


函数弹出窗口(元素,宽度,高度){

if(element.getAttribute){

url = element.getAttribute(''href'');

} else {

url = element;

}

new_window = window.open(url,''_ blank'',''width =''+ width +'',height =''

+ height +'',left ='' + Math.round((screen.width - width)/ 2)+'',top =''

+ Math.round((screen.height - height)/ 4)+'', location = 0,statusbar = 0,

menubar = 0,toolbar = 0,scrollbars = 1,resizable = yes'');

}


如果启用了Javascript,它应该有一个新的窗口,其中包含
的850和800的高度。如果javascript禁用了大图

应该在新鲜的窗口中打开(target =" _blank")。

< a href =" big.jpg"目标= QUOT;此处" onclick =" popup(this,850,screen.height-40)"

将打开一个新的裸窗口链接中的页面,其名称与被调用的名称相同在链接中(目标 - >''这里'')
所以......不需要''返回false''
不明白?如果javascript是

启用以防止浏览器在一个额外的新的

完整窗口中打开新网站,则使用部分_return false_

如果JS被禁用,那将打开一个空白的标准窗口



是的。


好​​的,我现在希望它清楚。


Markus写道:


你检查过我在第一个条目中发布的链接了吗?


我这样做了:
http://www.tweakpc.de/?news_id=8100

链接:

< a href =" / screenshot?show = p4_7ghz_memesama_big .jpg"

onclick =" popup(this,900,800);返回false target =" _blank">< img

class =" newspic_click" SRC =" /newspics/p4_7ghz_memesama.jpg" alt =" Bild"

title =" Zum vergr& ouml;& szlig; ern klicken" />< / a>

您的电脑上发生了什么?


我有一台Mac: - /

并获得2个新窗口(带有大jpg和一些移动装饰)

one在正常中空白

其他由window.open()

ok我忘了插入孔脚本。这是:

函数弹出窗口(元素,宽度,高度){
if(element.getAttribute){
url = element.getAttribute(''href'');
} else {
url = element;
}
new_window = window.open(url,''_ blank'',''width =''+ width +'', height =''
+ height +'',left =''+ Math.round((screen.width - width)/ 2)+'',top =''
+ Math.round( (screen.height - height)/ 4)+'',location = 0,statusbar = 0,
menubar = 0,toolbar = 0,scrollbars = 1,resizable = yes'');
}


它是状态而不是状态栏

尝试在window.open()的属性中没有空格

如果Javascript已启用它应该有一个新的窗口,其中包含850和800的高度。如果javascript禁用了大图,
应该在一个新的窗口中打开(target =" _blank") 。


看来它必须......

或许,如果你可以尝试给出相同的目标(和你一样)

- 到链接

- 到window.open()

但是真实姓名是_blank。 (即:某处)


这也可能会让你看到究竟是什么:

截图?show =

与链接中调用的名称相同(target - >''here'')
所以......不需要''return false''



不明白?如果启用了javascript以阻止浏览器在一个额外的新窗口中打开新网站,则使用部分_return false_。




是的,但是你使用的是_blank。作为弹出窗口中的目标...

在弹出功能中尝试没有目标:

new_window = window.open(element.href,'''',''blah blah'');


和......我犯了一个错误:

没有空白窗口你需要做的弹出窗口:


函数弹出窗口(宽度,高度){

new_window = window.open('''',''truc'',''width =''+ width +'',height =''

+ height +'',left =''+ Math.round((screen.width - width)/ 2)+'',top =''

+ Math.round((screen.height - height)/ 4)+

'',location = 0,status = 0,menubar = 0,toolbar = 0 ,scrollba rs = 1,resizable = 1'');

}


你的链接必须是:


< a href =" / screenshot?show = p4_7ghz_memesama_big.jpg"


target =" truc"


onclick =" popup(850,800)">< img src =" ...>< / a>

如果禁用JS,则会打开一个空白标准窗口



好​​的,我现在很清楚。




你的帖子很清楚


你的链接的JS结果不是太多: - /


我的例子(基于你的JS)在这里:
http://perso.wanadoo.fr/stephane.moriaux/truc/popup.htm

(我的FF工作正常)


-

Stephane Moriaux et son [moins] vieux Mac


Hi,

i have this problem:

Sometimes, i can''t reproduce, if i click on an small image on the
website, the popup _AND_ an other Tab in firefox open.

Here are the linkcode:

<div align="center">
<a href="/screenshot?show=p4_7ghz_memesama_big.jpg"
onclick="popup(this, 850, 800); return false" target="_blank"><img
class="newspic_click" src="/newspics/p4_7ghz_memesama.jpg" alt="Bild"
title="Zum vergr??ern klicken"></a>
</div>

Where? http://www.tweakpc.de/?news_id=8100 here for example

Why can this happen ? I have tried a lot, but nothing works.

--
Markus K.

解决方案

Markus wrote:

Hi,

i have this problem:

Sometimes, i can''t reproduce, if i click on an small image on the
website, the popup _AND_ an other Tab in firefox open.
your code in my FF (where I allow to open popups send from links)
open two new blank pages ... ! (and no other tab)
one naked and one complete
Here are the linkcode:

<div align="center">
<a href="/screenshot?show=p4_7ghz_memesama_big.jpg"
onclick="popup(this, 850, 800); return false" target="_blank"><img
class="newspic_click" src="/newspics/p4_7ghz_memesama.jpg" alt="Bild"
title="Zum vergr??ern klicken"></a>
</div>
what does exactly your function popup() ?
what is ''this'' for the function popup() in :
onclick="popup(this, 850, 800); ?
Where? http://www.tweakpc.de/?news_id=8100 here for example

Why can this happen ? I have tried a lot, but nothing works.



function popup(lnk,wiz,higt) {
here=window.open(lnk.href,''here'',''width=''+wiz+'',he ight=''+higt+'',resizable=1'');
//------------------------^----^ here = the target
}

<a href="big.jpg" target="here" onclick="popup(this,850,screen.height-40)">

will open the page hrefered in links in a new naked window targeted
with same name as called in link ( target -> ''here'' )
So ... no need of ''return false''

If JS is disabled, that will open a blank standard window

If popups are disabled in FF, I hope that it will open a new tab ... (?)

--
Stephane Moriaux et son [moins] vieux Mac


ASM wrote:

your code in my FF (where I allow to open popups send from links)
open two new blank pages ... ! (and no other tab)
one naked and one complete
Did you checked the link i posted in my first entry ? There is link to
a news with a small image that can be enlarged by clicking the picture.
What happend on your PC?

Here are the linkcode:

<div align="center">
<a href="/screenshot?show=p4_7ghz_memesama_big.jpg"
onclick="popup(this, 850, 800); return false" target="_blank"><img
class="newspic_click" src="/newspics/p4_7ghz_memesama.jpg" alt="Bild"
title="Zum vergr??ern klicken"></a>
</div>



what does exactly your function popup() ?
what is ''this'' for the function popup() in :
onclick="popup(this, 850, 800); ?



ok i forgot to insert the hole Script. Here it is:

function popup(element, width, height) {
if (element.getAttribute) {
url = element.getAttribute(''href'');
} else {
url = element;
}
new_window = window.open(url, ''_blank'', ''width='' + width + '', height=''
+ height + '', left='' + Math.round((screen.width - width)/2) + '', top=''
+ Math.round((screen.height - height)/4) + '', location=0, statusbar=0,
menubar=0, toolbar=0, scrollbars=1, resizable=yes'');
}

If Javascript is enabled it should be there one new window with witdh
of 850 and height of 800. And if javascript disabled the big picture
should be open in an fresh ne window (target="_blank").
<a href="big.jpg" target="here" onclick="popup(this,850,screen.height-40)">

will open the page hrefered in links in a new naked window targeted
with same name as called in link ( target -> ''here'' )
So ... no need of ''return false'' Dont understand ? the part _return false_ is used if javascript is
enabled to prevent the browser to open the new site in an extra new
full window.
If JS is disabled, that will open a blank standard window


yes.

Ok i hope now its clear.


Markus wrote:


Did you checked the link i posted in my first entry ?
I did this :
http://www.tweakpc.de/?news_id=8100
link :
<a href="/screenshot?show=p4_7ghz_memesama_big.jpg"
onclick="popup(this, 900, 800); return false" target="_blank"><img
class="newspic_click" src="/newspics/p4_7ghz_memesama.jpg" alt="Bild"
title="Zum vergr&ouml;&szlig;ern klicken" /></a>
What happend on your PC?
I have a Mac :-/
and obtain 2 new windows (with big jpg and some moving decorations)
one in "normal" blank
other by window.open()
ok i forgot to insert the hole Script. Here it is:

function popup(element, width, height) {
if (element.getAttribute) {
url = element.getAttribute(''href'');
} else {
url = element;
}
new_window = window.open(url, ''_blank'', ''width='' + width + '', height=''
+ height + '', left='' + Math.round((screen.width - width)/2) + '', top=''
+ Math.round((screen.height - height)/4) + '', location=0, statusbar=0,
menubar=0, toolbar=0, scrollbars=1, resizable=yes'');
}
it is status and not statusbar
try to do not have spaces in the attributes of window.open()
If Javascript is enabled it should be there one new window with witdh
of 850 and height of 800. And if javascript disabled the big picture
should be open in an fresh ne window (target="_blank").
It seems it would have to ...
Perhaps, if you could try giving same target (as you do)
- to the link
- to the window.open()
but with a real name insteed of "_blank" (i.e : "somewhere")

It also would be interresting you see what exactly does :
screenshot?show=

with same name as called in link ( target -> ''here'' )
So ... no need of ''return false''



Dont understand ? the part _return false_ is used if javascript is
enabled to prevent the browser to open the new site in an extra new
full window.



Yes usualy, but you use "_blank" as target in your popup ...
try without target in your popup function :
new_window = window.open(element.href,'''','' blah blah '');

and ... I made a mistake :
to do not have blank window AND popup you would have to do :

function popup(width,height) {
new_window = window.open('''',''truc'',''width='' + width + '',height=''
+ height + '', left='' + Math.round((screen.width - width)/2) + '',top=''
+ Math.round((screen.height - height)/4) +
'',location=0,status=0,menubar=0,toolbar=0,scrollba rs=1,resizable=1'');
}

and your link would have to be :

<a href="/screenshot?show=p4_7ghz_memesama_big.jpg"

target="truc"

onclick="popup(850,800)"><img src=" ...></a>

If JS is disabled, that will open a blank standard window


Ok i hope now its clear.



your post was clear

the JS result of your link not too much :-/

my example (based on your JS) is here :
http://perso.wanadoo.fr/stephane.moriaux/truc/popup.htm
(it works fine with my FF)

--
Stephane Moriaux et son [moins] vieux Mac


这篇关于popup只用firefox打开问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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