在没有填充的新窗口中打开图像 [英] Opening image in new window without padding

查看:56
本文介绍了在没有填充的新窗口中打开图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在尝试打开一个包含图像的窗口,我希望

图像与窗口齐平 - 即没有填充或

边框。我可以通过一次调用窗口来实现这一点。开启

函数?我宁愿不创建单独的HTML页面。到目前为止

我所拥有的只是基本的


var cwin = window.open(''images / KJV-THANKS.gif'',
''谢谢'',''宽度= 243,身高= 420,'');

cwin.focus();


如果有任何跨浏览器的JS我可以添加以消除

新窗口中的填充,那就太棒了。


谢谢, - 戴夫

Hello,
I am trying to open a window containing an image and I would like
the image to be flush against the window -- i.e. have no padding or
border. Can I make this happen with a single call to a window.open
function? I would prefer not to create a separate HTML page. So far
all I have is the basic

var cwin = window.open(''images/KJV-THANKS.gif'',
''Thanks'', ''width=243,height=420,'');
cwin.focus();

If there''s any cross-browser JS I can add to eliminate padding in the
new window, that would be awesome.

Thanks, - Dave

推荐答案

la ** *********@gmail.com (D。Alvarado)写道:
la***********@gmail.com (D. Alvarado) wrote:
我正在尝试打开一个包含图像的窗口
I am trying to open a window containing an image




不,它打破了用户的功能,如果用户想要一个新窗口

他们可以自己打开它。不要强迫你偏爱别人。


-

Spartanicus



Don''t, it breaks a users back function, if a user wants a new window
they can open it themselves. Don''t force your preference onto others.

--
Spartanicus


23 2004年8月10:50:57 -0700,D。Alvarado< la *********** @ gmail.com>写道:
On 23 Aug 2004 10:50:57 -0700, D. Alvarado <la***********@gmail.com> wrote:
您好,
我正在尝试打开一个包含图像的窗口,我希望图像能够与窗口齐平 - 即没有填充或边界。我可以通过一次调用window.open
函数来实现这一点吗?我宁愿不创建单独的HTML页面。到目前为止我所拥有的只是基本的

var cwin = window.open(''images / KJV-THANKS.gif'',
''谢谢'',' 'width = 243,height = 420,'');
cwin.focus();

如果有任何跨浏览器的JS我可以添加以消除<新窗口,那将是非常棒的。

谢谢, - 戴夫
Hello,
I am trying to open a window containing an image and I would like
the image to be flush against the window -- i.e. have no padding or
border. Can I make this happen with a single call to a window.open
function? I would prefer not to create a separate HTML page. So far
all I have is the basic

var cwin = window.open(''images/KJV-THANKS.gif'',
''Thanks'', ''width=243,height=420,'');
cwin.focus();

If there''s any cross-browser JS I can add to eliminate padding in the
new window, that would be awesome.

Thanks, - Dave




我读过这篇文章有多少这样的帖子单独过去一周?


用javascript打开这样的新窗口是不值得的。


1)没有Javascript的用户可以''无论如何都要看。

2)有弹出窗口拦截器的用户也看不到它。

3)如果有充分理由打开一个新窗口,用户可以很容易地做到这一点




我觉得有点讽刺的是强迫新窗口感谢用户 - 谢谢

是不是因为没有离开使用弹出窗口的网站?



How many of this type of post have I read this past week alone?

Opening new windows like this with javascript is not worth it.

1) Users w/o Javascript can''t see it anyhow.
2) Users with pop-up blockers can''t see it either.
3) If there is some good reason to open a new window, the user can do it
himself quite easily.

I find a little irony in forcing a new window to thank the user - thanks
for not leaving a site which uses popups, perhaps?


Neal wro te:
Neal wrote:
2004年8月23日10:50:57 -0700,D。Alvarado< la *********** @ gmail.com>写道:
On 23 Aug 2004 10:50:57 -0700, D. Alvarado <la***********@gmail.com> wrote:
您好,
我正在尝试打开一个包含图像的窗口,我希望图像能够与窗口齐平 - 即没有填充或边界。我可以通过一次调用window.open
函数来实现这一点吗?我宁愿不创建单独的HTML页面。到目前为止我所拥有的只是基本的

var cwin = window.open(''images / KJV-THANKS.gif'',
''谢谢'',' 'width = 243,height = 420,'');
cwin.focus();

如果有任何跨浏览器的JS我可以添加以消除<新窗口,那真是太棒了。

谢谢, - 戴夫

我上周一周读过这类帖子有多少?

使用javascript打开这样的新窗口是不值得的。

1)没有Javascript的用户无论如何都看不到它。
Hello,
I am trying to open a window containing an image and I would like
the image to be flush against the window -- i.e. have no padding or
border. Can I make this happen with a single call to a window.open
function? I would prefer not to create a separate HTML page. So far
all I have is the basic

var cwin = window.open(''images/KJV-THANKS.gif'',
''Thanks'', ''width=243,height=420,'');
cwin.focus();

If there''s any cross-browser JS I can add to eliminate padding in the
new window, that would be awesome.

Thanks, - Dave

How many of this type of post have I read this past week alone?

Opening new windows like this with javascript is not worth it.

1) Users w/o Javascript can''t see it anyhow.



如果您相应地编码链接的目标属性,则不会。

< a href =" images / KJV-THANKS.gif" target =" Thanks"

onclick =" OpenRequestedPopup(this.href,this.target);返回false;">

2)有弹出窗口阻止程序的用户也看不到它。


不正确。通常,弹出窗口阻止程序设置为阻止打开

未经授权的弹出窗口,在onload

事件期间和onunload事件期间打开意外窗口。

3)如果有充分的理由打开一个新窗口,用户可以很容易地完成它。


只要你不打开多个弹出窗口,只要你回收

a单个弹出窗口,只要你的网页设计证明这个

场景没有强加给用户,只要你关注WAI

关于弹出窗口的指导方针,然后我没有看到一个重大问题。

我发现有点讽刺强迫


强迫永远是坏事;将此作为一个场景提交给用户(并且一般来说是:b $ b b编码网页的灵活性和可访问性)和

然后让他自由选择自己的路径是另一个故事。 br />

a新窗口感谢用户 - 感谢您不要离开使用弹出窗口的网站,或许?



Not if you code accordingly the target attribute of the link.
<a href="images/KJV-THANKS.gif" target="Thanks"
onclick="OpenRequestedPopup(this.href, this.target); return false;">
2) Users with pop-up blockers can''t see it either.
Not true. Usually, popup blockers are set to prevent opening of
unsollicited popup windows, unexpected windows opening during the onload
event and during the onunload event.
3) If there is some good reason to open a new window, the user can do it
himself quite easily.

As long as you don''t open multiple popup windows, as long as you recycle
a single popup window, as long as your webpage design justifies this
scenario without imposing it to the user, as long as you follow WAI
guidelines regarding popups, then I don''t see a major issue.
I find a little irony in forcing
forcing is always bad; proposing this as a scenario to the user (and
generally speaking: coding webpage flexibility and accessibility) and
then letting him free to choose his own path is another story.

a new window to thank the user - thanks for not leaving a site which uses popups, perhaps?




关于弹出窗口的可用性研究已经证明,使用弹出窗口创建的实际

结果通常与网络作者的原始意图完全相反。换句话说,人们会花费一个比使用弹出窗口更频繁使用弹出窗口的网站。


编码请求的弹出窗口通常在书籍,教程和

在javascript copy-N-paste网站中。原始海报提供的上述代码块是另一个典型的例子。


var cwin = window.open(''images / KJV- THANKS.gif'',

''谢谢'',''宽度= 243,身高= 420,'');


cwin这是一个对窗口对象的引用应该是全局的,而不是

局部变量。按照编码,弹出窗口不能在MSIE

5+中调整大小,如果内容超出

请求的窗口,它就不会呈现滚动条尺寸,它不会呈现状态栏...这是一个很好的,有希望永远改变的事情,这将是一个很好的事情。


"如果功能已启用Windows限制,此功能:

强制状态栏出现在脚本启动的Internet中

带有标题栏的资源管理器窗口[创建的那些]与

window.open()]。 (...)以确保这些窗口中的标题栏和状态栏始终对用户可见。

Microsoft Windows XP中功能的更改Service Pack 2

第5部分:增强的浏览安全性
http://www.microsoft.com/technet/pro.../sp2brows.mspx


cwin.focus() ;


同样,这个编码很糟糕。应该测试引用返回

一个对象然后如果它存在但没有关闭,那么你应该把

放在最上面。编码没有这种智能测试。


DU



Usability studies regarding popups have demonstrated that the actual
results reached, created by the use of popups is generally the exact
opposite of the web author''s original intents. In other words, people
leave a site which uses popups more often than they stay.

Coding requested popups is generally poorly done in books, tutorials and
in javascript copy-N-paste sites. The above chunk of code provided by
the original poster is another typical example of this.

var cwin = window.open(''images/KJV-THANKS.gif'',
''Thanks'', ''width=243,height=420,'');

cwin which is a reference to the window object should be global, not a
local variable. As coded, the popup window won''t be resizable in MSIE
5+, it won''t render scrollbars if by any chance the content exceeds the
requested window dimensions and it won''t render status bar... which is a
thing that SP2 will change for good and hopefully forever

"if the feature is turned on for Windows Restrictions, this feature:
Forces the status bar to be present in script-initiated Internet
Explorer windows with the title bar [those that were created with
window.open()]. (...) to ensure that the title bar and the status bar in
these windows is always visible to the user."
Changes to Functionality in Microsoft Windows XP Service Pack 2
Part 5: Enhanced Browsing Security
http://www.microsoft.com/technet/pro.../sp2brows.mspx

cwin.focus();

Again, this is badly coded. The reference should be tested for returning
an object and then if it exists but is not closed, then you should bring
in on top. The coded makes no smart testing of this sort.

DU


这篇关于在没有填充的新窗口中打开图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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