本文介绍了名称属性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些关于名称属性和href引用的问题

to。你可以声明除了锚

元素(如div或h2)以外的标签的名称属性吗?对于HTML 4.0严格,验证器一直返回以下

错误。


第139行,第12列:没有属性NAME


< h2 name =" heading"> H2标题< / h2>


|您已在文档中使用上面提到的属性,但文档类型为|您使用的不支持此元素的该属性。这个错误通常是

|不正确使用严格引起的具有使用框架的文档的文档类型(例如,您必须使用过渡文档类型来获取目标属性),或者使用供应商专有扩展(例如marginheight)。 (这通常通过使用CSS来实现所需效果来修复)。


我的目标是创建指向文档特定部分的热链接。

此目标不涉及传统锚元素(href)涵盖的当前

文档之外的文档。一位开发人员

建议你可以更换以下内容。


< a name =" heading">< / a>


< h2 name =" heading"> H2标题< / h2>


所以我做了更改并发现这些更改没有

验证。这个发现发生在距离文件

有一段时间之后。在重新访问该文件时,错误让我感到困惑和困难。一个快速的谷歌搜索只引导我

关于传统锚点和名称属性的描述。这些

结果未提及其他元素中的名称属性。也许,我

不记得文档中热链接的正确用语。

有没有人有任何链接可以解释我所谓的热门链接?

这种情况​​只发生在HTML 4.0(而不是xHTML)中吗?如果合适,请给出一个

这个主题的简要描述。

I have a few questions about the name attributes and href referencing
to. Can you declare name attributes for tags other than anchor
elements (like div or h2)? The validator keeps returning the following
error for HTML 4.0 strict .

Line 139, column 12: there is no attribute "NAME"

<h2 name="heading">H2 Headline </h2>

| 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).

My goal is to create hot links to specific sections of the document.
This objective does not refer to documents outside the current
document covered by traditional anchor elements (href). One developer
suggested that you could replace the following.

<a name="heading"></a>

<h2 name="heading">H2 Headline </h2>

So I made the changes and discovered that these changes did not
validate. This discovery happens after sometime away from the document
in question. Upon revisiting the document, the errors left me
perplexed and at odds. A quick Google search only led me to
descriptions about traditional anchors and the name attributes. These
results did not mention name attributes in other elements. Maybe, I
did not remember the correct term for hot links within a document.
Does anybody have any links that explain what I call hot links? Does
this scenario only occur in HTML 4.0 (and not xHTML)? Please give a
brief description of this topic if appropriate.

推荐答案



使用" id"标签。 id值必须是唯一的才能验证。


-

jmm dash list(at)sohnen-moe(dot)com

(删除电子邮件的.AXSPAMGN)


Use the "id" tag. The id value must be unique to validate.

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)





< div style =" width:100%;">

< h2 id =" lab0">< a name =" lab0"> INTRODUCTION。< / a>< / h2>

< / div>

-

杰克

(ja**@gododdin.demon.co.uk ......只是一个垃圾邮件陷阱。 )



<div style="width:100%;">
<h2 id="lab0"><a name="lab0">INTRODUCTION.</a></h2>
</div>
--
Jake
(ja**@gododdin.demon.co.uk .... just a spam trap.)





看看
$ b $中的非法示例b< http://www.w3.org/TR/html4/struct/links.html#h-12.2.3>


xpost和f''up2 ciwah

-

Johannes Koch

in te domine speravi;非永久性的东西。

(Te Deum,4美分。)



Have a look at the illegal example in
<http://www.w3.org/TR/html4/struct/links.html#h-12.2.3>

xpost and f''up2 ciwah
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)


这篇关于名称属性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 13:26