HTML4.01 STRICT和带目标的超链接 [英] HTML4.01 STRICT and hyperlinks with target

查看:50
本文介绍了HTML4.01 STRICT和带目标的超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



小组,


我遇到了页面验证错误,但我不知道解决方法。

该页面具有以下doctype:

<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 // EN"

" ; http://www.w3.org/TR/html4/strict.dtd">


有些超链接需要打开到新窗口,所以我使用了(错误的)

target =""属性。


w3c验证给了我这个:


------------------ ---------------------------------------------

验证输出:1错误

---------------------------------- -----------------------------

1.错误第13行,第108列:没有属性TARGET。


?=" http://www.example.com" target =" _blank"> mylink< / aen


您在文档中使用了上面提到的属性,但是您使用的是

文档类型不支持此

元素的该属性。此错误通常是由于使用框架的文档错误地使用严格

文档类型引起的(例如,您必须使用

Transitional文档类型获得目标属性,或者使用

供应商专有扩展,例如marginheight等。 (这通常是通过使用CSS来实现所需效果的
)。


如果元素本身不受支持,也可能导致此错误

您正在使用的文档类型,因为未定义的元素将没有

支持的属性;在这种情况下,请参阅元素未定义错误

消息以获取更多信息。


如何修复:检查元素和属性的拼写和大小写,

(记住XHTML都是小写的)和/或检查它们是否在所选文档类型中允许

,和/或使用CSS代替此

属性。如果您在网页中使用< embedelement

合并Flash媒体时收到此错误,请参阅有效闪存上的常见问题项目。

------ -------------------------------------------------- -------

我的问题:如何在没有

JavaScript的超链接中使用好的旧目标?


感谢您的时间。


问候,

Erwin Moller


-

============================

Erwin Moller

现在下降来自googlegroups的所有帖子。

为什么? http://improve-usenet.org/

= ===========================


Hi group,

I encoutered page validation error, but I don''t know a way around.

The page has the following doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

Some hyperlinks need to open to a new window, so I used the (wrong)
target="" attribute.

w3c validation gave me this:

---------------------------------------------------------------
Validation Output: 1 Error
---------------------------------------------------------------
1. Error Line 13, Column 108: there is no attribute "TARGET".

?="http://www.example.com" target="_blank">mylink</aen

You have used the attribute named above in your document, but the
document type you are using does not support that attribute for this
element. This error is often caused by incorrect use of the "Strict"
document type with a document that uses frames (e.g. you must use the
"Transitional" document type to get the "target" attribute), or by using
vendor proprietary extensions such as "marginheight" (this is usually
fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the
document type you are using, as an undefined element will have no
supported attributes; in this case, see the element-undefined error
message for further information.

How to fix: check the spelling and case of the element and attribute,
(Remember XHTML is all lower-case) and/or check that they are both
allowed in the chosen document type, and/or use CSS instead of this
attribute. If you received this error when using the <embedelement to
incorporate flash media in a Web page, see the FAQ item on valid flash.
---------------------------------------------------------------
My question: How do I use the good old target in hyperlinks without
JavaScript?

Thanks for your time.

Regards,
Erwin Moller

--
============================
Erwin Moller
Now dropping all postings from googlegroups.
Why? http://improve-usenet.org/
============================

推荐答案

你有3种选择:

- 不要试图指定目标窗口,让使用选择(首选

由纯粹主义者)

- 使用javascript;这样页面验证,但每个链接的目标

在加载时更改(验证折衷解决方法)

- 正常使用目标属性,只是忽略验证错误。


对我而言,验证是达到目的的手段。对于我的许多网站和

应用程序,我主动希望(通常是外部的)链接在新的

窗口中打开。通常我不想把它留给用户 - 通常是因为我的

用户群如果他们的生活依赖于我的

用户群就不能移动点击/按住Ctrl键点击/右击/>
就可以了(即使屏幕上有提示),但通常是因为我正在开发需要以固定方式运行的
应用程序。在这些情况下,我不希望

将选择留给用户,比我允许他们在我的一个桌面应用程序中选择



对于更传统的,面向互联网的网站(而不是内联网

应用程序),我倾向于将选择留给用户,但是并非总是如此。


这将是NG中的一个反对派帖子,但我认为我的立场是一个受欢迎的好消息。但是,我希望看到标准的变化,以允许

属性建议为目标并允许用户浏览器设置

来确定它们是否为想接受默认建议,或者自己选择做出
。我认为这会吸引纯粹主义者,但仍然为群众提供


只需我0.02英镑。

You have 3 choices:
- don''t try to specify the target window, and let the use choose (preferred
by the purists)
- use javascript; such that the page validates, but the target of each link
is changed on load (the validating compromise workaround)
- use target attribute as normal, and just ignore the validation errors.

To me, validation is a means to an end. And for many of my sites and
applications, I actively want the (usually external) link to open in a new
window. Often I don''t want to leave it up to a user - usually because my
user-base couldn''t shift-click/ctrl-click/right-click if their life depended
on it (even with on-screen prompts), but often because I''m developing
applications that need to behave in a set way. In these cases, I don''t want
to leave the choice up to the user, any more than I would allow them to
choose in one of my desktop applications.

For more conventional, internet-facing websites (as opposed to intranet
applications), I do tend to leave the choice up to the user, but not always.

This will be a contraversial post in this NG, but I think my stance is a
popular one. However, I would like to see a change in the standards to allow
an attribute that ''suggests'' a target and allow the users browser settings
to determine whether they want to accept the default suggestions, or make
their own choices. I think this would appeal to the purists, but still cater
for the masses.
Just my £0.02.




CJM schreef:

CJM schreef:

你有3个选择:

- don'' t尝试指定目标窗口,并让使用选择

(纯粹主义者首选)

- 使用javascript;使页面有效,但每个

链接的目标在加载时更改(验证折衷解决方法)

- 正常使用目标属性,并忽略验证错误。


对我而言,验证是达到目的的手段。对于我的许多网站和

应用程序,我主动希望(通常是外部的)链接在

新窗口中打开。通常我不想把它留给用户 - 通常是

因为我的用户群无法按住键点击/按住Ctrl键单击/右键单击如果

他们的生活依赖于它(即使屏幕上有提示),但通常是b $ b因为我正在开发需要以固定方式行事的应用程序。在

这些情况下,我不想将选择留给用户,而不是我允许他们在我的桌面应用程序中选择的b $ b。 。


对于更传统的,面向互联网的网站(而不是内联网

应用程序),我倾向于将选择留给用户,但是不是

总是。


这将是NG中的一个反对派帖子,但我认为我的立场是

受欢迎的一个。但是,我希望看到标准的变化为

允许一个属性建议一个目标并允许用户浏览器

设置来确定它们是否是想接受默认的

建议,或者自己做出选择。我认为这会吸引纯粹的b / b
,但仍然适合群众。

只需我0.02英镑。
You have 3 choices:
- don''t try to specify the target window, and let the use choose
(preferred by the purists)
- use javascript; such that the page validates, but the target of each
link is changed on load (the validating compromise workaround)
- use target attribute as normal, and just ignore the validation errors.

To me, validation is a means to an end. And for many of my sites and
applications, I actively want the (usually external) link to open in a
new window. Often I don''t want to leave it up to a user - usually
because my user-base couldn''t shift-click/ctrl-click/right-click if
their life depended on it (even with on-screen prompts), but often
because I''m developing applications that need to behave in a set way. In
these cases, I don''t want to leave the choice up to the user, any more
than I would allow them to choose in one of my desktop applications.

For more conventional, internet-facing websites (as opposed to intranet
applications), I do tend to leave the choice up to the user, but not
always.

This will be a contraversial post in this NG, but I think my stance is a
popular one. However, I would like to see a change in the standards to
allow an attribute that ''suggests'' a target and allow the users browser
settings to determine whether they want to accept the default
suggestions, or make their own choices. I think this would appeal to the
purists, but still cater for the masses.
Just my £0.02.



嗨CJM,


感谢您的明确回复。

所以结论是STRICT doctype只是禁止这个有用的

属性。

这很烦人。在我看来,这是严格的doctype的设计错误w3c

。如果你把一些东西扔出窗外,至少

提供了一种方法/方法(以不同的方式)。


因为它不是作为开发人员,我需要我的

(互联网)客户端的JavaScript,我不想要JavaScript解决方案。

我想我会关注你的选项3:只需使用目标并忽略

验证错误。


谢谢。


问候,

Erwin Moller

-

======================== ====

Erwin Moller

现在放弃googlegroups的所有帖子。

为什么? http://improve-usenet.org/

= ===========================

Hi CJM,

Thank you for your clear response.
So the conclusion is that STRICT doctype simply forbids this useful
attribute.
That is annoying. In my humble opinion, this is a designmistake of w3c
for strict doctype. If you throw something out of the window, at least
offer a method/way of doing the same (in a different way).

Since it isn''t up to me as the developer to demand JavaScript of my
(internet) clients, I don''t want a JavaScript solution.
I think I follow your option 3: Simply use target and ignore the
validation error.

Thanks.

Regards,
Erwin Moller
--
============================
Erwin Moller
Now dropping all postings from googlegroups.
Why? http://improve-usenet.org/
============================


在我们的上一集中,

< 48 ********************* @ news.xs4all.nl>,

可爱而有才华的欧文Moller

在comp.infosystems上播出。 www.authoring.html:

In our last episode,
<48*********************@news.xs4all.nl>,
the lovely and talented Erwin Moller
broadcast on comp.infosystems.www.authoring.html:


你好组,
Hi group,


我遇到了页面验证错误,但我不知道解决方法。
I encoutered page validation error, but I don''t know a way around.


该页面具有以下doctype:
<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 // EN"

" http://www.w3.org/TR/html4/strict.dtd">
The page has the following doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">


有些超链接需要打开到新窗口,
Some hyperlinks need to open to a new window,



编号没有超链接需要在新窗口中打开。如果你没有尝试使用
陷阱用户,让他们控制自己的浏览器。如果您正试图陷入

用户,请在其他地方寻求帮助。


-

Lars Eighner< http:/ /larseighner.com/ us****@larseighner.com

每日比格犬< http ://larseighner.com/Daily_Beagle/>

有充足的一天。

No. No hyperlinks need to open in a new window. If you are not trying to
trap users, let them control their own browsers. If you are trying to trap
users, look for help elsewhere.

--
Lars Eighner <http://larseighner.com/us****@larseighner.com
The Daily Beagle <http://larseighner.com/Daily_Beagle/>
Have an adequate day.


这篇关于HTML4.01 STRICT和带目标的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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