&LT a取代;不能是< A&gt ;?的容器 [英] <A> Cannot be a Container for <A>?

查看:47
本文介绍了&LT a取代;不能是< A&gt ;?的容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试过以下方法:


< a name =" foo" class =" foostyle">文件foo< a href =" bar">链接foo< / a>

和更多文字。< / a>


我有点认为oughta工作。但是我发现foostyle只应用于foo中的链接
。之后,风格消失了。这个

发生在Mozilla和MSIE中。即使添加上下文选择器

风格也没有帮助。


我使用Mozilla作曲家玩它,发现

作曲家总是重新定位< / a>在

< a>之前的锚点为链接。对我来说意味着< A>不能是一个容器

的< A>。那是对的吗?或者还有别的什么东西我可以俯瞰吗?


因为我不太可能改变99%的<% br />
那里的浏览器,更重要的是我弄清楚该做什么

。我正在做的是使用一些脚本动态切换样式

,以突出显示一段文字。这样做的原因是b / b
方式源于document.anchors得到了支持的事实

Mozilla和MSIE。我希望文本包含链接,但

突出显示会在链接处停止。我现在所做的就是将其编码为


< a name =" foo" HREF ="栏" class =" foostyle"> foo中的文字,链接在

foo和更多文字中。< / a>


哪个有效,但有将整个

部分转换为链接并将每个部分限制为仅一个链接的副作用令人不满意。

http://www.rffutah.org/


是我正在谈论的页面。右侧的日历由脚本创建

,当您将鼠标移动到9月的日期

(8月没有热门日期)时,则相应部分

以上点亮。我删除了文字下划线,因为下划线的整个

部分看起来没有吸引力。但是,如果我知道如何在no< A>周围获得

在< A>中< A>限制,我会更开心。

-

Helge Molding

mailto:hm ******* @ excite.com只是另一个人
http://hmoulding.cjb.net/有一个奇怪的名字

I''ve tried the following:

<a name="foo" class="foostyle">Text in foo <a href="bar">link in foo</a>
and more text.</a>

I kinda thought that oughta work. But I found that foostyle is applied
only up to the link in foo. After that the style disappears. This
happens in both Mozilla and MSIE. Even adding contextual selectors to
the style doesn''t help.

I played around with it using the Mozilla composer, and found that the
composer always repositions the </a> for the anchor to just before the
<a> for the link. To me that implies that an <A> cannot be a container
for an <A>. Is that correct? Or is there something else that I''m
overlooking?

Since I''m not likely going to change the implementation of 99% of the
browsers out there, it''s more important that I figure out what to do
about this. What I''m doing is using a bit of script to switch styles
dynamically, to highlight a piece of text. The reason for doing it this
way stems from the fact that document.anchors is supported by both
Mozilla and MSIE. I''d like the text to include links, but then the
highlight stops at the link. What I''ve done for now is to code it as

<a name="foo" href="bar" class="foostyle">Text in foo with link in
foo and more text.</a>

which works, but has the unsatisfying side effect of turning the entire
section into a link, and limiting me to just one link per section.

http://www.rffutah.org/

is the page I''m talking about. The calendar on the right side is created
by the script, and when you move the mouse over the dates in September
(there are no hot dates in August), then the corresponding sections
above light up. I''ve removed the text underline, because an entire
section underlined looks unattractive. But if I knew of a way to get
around the "no <A> in <A>" limitation, I''d be a lot happier.
--
Helge Moulding
mailto:hm*******@excite.com Just another guy
http://hmoulding.cjb.net/ with a weird name

推荐答案

2004年8月21日星期六13:28:23 -0600,Helge Molding< hm ***** **@excite.com>

写道:
On Sat, 21 Aug 2004 13:28:23 -0600, Helge Moulding <hm*******@excite.com>
wrote:
我试过以下内容:

< a name = " FOO" class =" foostyle">文件foo< a href =" bar">链接foo< / a>
和更多文字。< / a>

我觉得有点工作。但我发现foostyle仅适用于foo中的链接。之后,风格消失了。这个
发生在Mozilla和MSIE中。即使添加上下文选择器也没有帮助。

我使用Mozilla作曲家玩它,发现
作曲家总是重新定位< /一个>对于在
< a>之前的锚点为链接。对我来说意味着< A>不能成为< A>的容器。那是对的吗?或者还有其他我忽视的东西?
I''ve tried the following:

<a name="foo" class="foostyle">Text in foo <a href="bar">link in foo</a>
and more text.</a>

I kinda thought that oughta work. But I found that foostyle is applied
only up to the link in foo. After that the style disappears. This
happens in both Mozilla and MSIE. Even adding contextual selectors to
the style doesn''t help.

I played around with it using the Mozilla composer, and found that the
composer always repositions the </a> for the anchor to just before the
<a> for the link. To me that implies that an <A> cannot be a container
for an <A>. Is that correct? Or is there something else that I''m
overlooking?



http://www.w3.org/TR/html401/struct/links.html#h-12.2.2


" A元素定义的链接和锚点不能嵌套; A

元素不得包含任何其他A元素。



http://www.w3.org/TR/html401/struct/links.html#h-12.2.2

"Links and anchors defined by the A element must not be nested; an A
element must not contain any other A elements."




" Helge Molding" < HM ******* @ excite.com>在消息中写道

news:cg ********** @ news.xmission.com ...

"Helge Moulding" <hm*******@excite.com> wrote in message
news:cg**********@news.xmission.com...
我试过以下内容:

< a name =" foo" class =" foostyle">文件foo< a href =" bar">链接foo< / a>
和更多文字。< / a>

我觉得有点工作。
I''ve tried the following:

<a name="foo" class="foostyle">Text in foo <a href="bar">link in foo</a>
and more text.</a>

I kinda thought that oughta work.




看起来你错了,是吧?
http://www.w3.org/TR/html401/struct/links.html#h-12.2 .2


-Karl



Looks like you thought wrong, huh?
http://www.w3.org/TR/html401/struct/links.html#h-12.2.2

-Karl


在我们的上一集中,

< cg**********@news.xmission.com>,

可爱而有才华的Helge Molding

在comp.infosystems上广播。 www.authoring.html:
In our last episode,
<cg**********@news.xmission.com>,
the lovely and talented Helge Moulding
broadcast on comp.infosystems.www.authoring.html:
我已经尝试了以下内容:
< a name =" foo" class =" foostyle">文件foo< a href =" bar">链接foo< / a>
和更多文字。< / a>
我觉得有点工作。但我发现foostyle仅适用于foo中的链接。之后,风格消失了。这个
发生在Mozilla和MSIE中。即使添加上下文选择器也没有帮助。


您没有说出您正在使用的DTD,但我找不到允许使用

< a>在< a>中另外,我打赌你的意思是href =" #bar"。您可以在同一< a>中同时使用名称

和href属性。这可能会,也可能不会,你想做什么:


< span class =" foostyle"> foo< a name =" foo" href =" #bar">链接在foo< / a>

和更多文字。< / span>


我玩弄了它使用Mozilla作曲家,发现
作曲家总是重新定位< / a>对于在
< a>之前的锚点为链接。对我来说意味着< A>不能成为< A>的容器。那是对的吗?


是的。你不能嵌套< a> s。

或者还有别的东西我会忽略吗?
因为我不太可能改变99%的浏览器的实现,所以我更明白我要弄清楚该做什么。我正在做的是使用一些脚本动态切换样式,以突出显示一段文本。之所以这样做是因为document.anchors得到了Mozilla和MSIE的支持。我希望文本包含链接,然后
突出显示在链接处停止。我现在所做的就是将其编码为
< a name =" foo" HREF ="栏" class =" foostyle"> foo中的文字,其中包含
foo中的链接和更多文字。< / a>


这也会有效,如果你真的是指href =" bar"而不是href ="#bar"。

哪个有效,但是将整个
部分变成链接并且限制我每个部分只有一个链接的副作用令人不满意。
http://www.rffutah.org/
是我正在谈论的页面。右侧的日历是由脚本创建的,当您将鼠标移动到9月的日期上时(8月没有热门日期),则上面的相应部分
点亮。我删除了文字下划线,因为下划线的整个部分看起来没有吸引力。但是,如果我知道如何围绕no< A>获取
在< A>中< A>限制,我会更高兴。
I''ve tried the following: <a name="foo" class="foostyle">Text in foo <a href="bar">link in foo</a>
and more text.</a> I kinda thought that oughta work. But I found that foostyle is applied
only up to the link in foo. After that the style disappears. This
happens in both Mozilla and MSIE. Even adding contextual selectors to
the style doesn''t help.
You didn''t say what DTD you are using, but I can''t find one that allows
<a> in <a>. Also, I bet you mean href="#bar". You can have both name
and href attributes in the same <a>. This might, or might not, do
what you want to do:

<span class="foostyle">Text in foo <a name="foo" href="#bar">link in foo</a>
and more text.</span>

I played around with it using the Mozilla composer, and found that the
composer always repositions the </a> for the anchor to just before the
<a> for the link. To me that implies that an <A> cannot be a container
for an <A>. Is that correct?
Yes. You cannot nest <a>s.
Or is there something else that I''m
overlooking? Since I''m not likely going to change the implementation of 99% of the
browsers out there, it''s more important that I figure out what to do
about this. What I''m doing is using a bit of script to switch styles
dynamically, to highlight a piece of text. The reason for doing it this
way stems from the fact that document.anchors is supported by both
Mozilla and MSIE. I''d like the text to include links, but then the
highlight stops at the link. What I''ve done for now is to code it as <a name="foo" href="bar" class="foostyle">Text in foo with link in
foo and more text.</a>
That will work too, if you really mean href="bar" instead of href="#bar".
which works, but has the unsatisfying side effect of turning the entire
section into a link, and limiting me to just one link per section. http://www.rffutah.org/ is the page I''m talking about. The calendar on the right side is created
by the script, and when you move the mouse over the dates in September
(there are no hot dates in August), then the corresponding sections
above light up. I''ve removed the text underline, because an entire
section underlined looks unattractive. But if I knew of a way to get
around the "no <A> in <A>" limitation, I''d be a lot happier.




-

Lars Eighner - 极客代码的手指 - ei ***** @ io.com http://www.io.com/~eighner/

如果不是肌肉痉挛,我就不会得到任何完全锻炼。



--
Lars Eighner -finger for geek code- ei*****@io.com http://www.io.com/~eighner/
If it wasn''t for muscle spasms, I wouldn''t get any exercise at all.


这篇关于&LT a取代;不能是&lt; A&gt ;?的容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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