Javascript,Firefox和document.links [英] Javascript, Firefox and document.links
问题描述
他在那里!
我发现了
================= ================================
document.links(''link_id_here'') .href =" something";
================================== ===============
不适用于Firefox(即使是1.0.6),而且我正在堕落/>
通过数组并检查每个链接ID。
可以有人确认它是真的和/或直接更优雅
解决方案如果有的话?
Thanx,
Andrew
an********@gmail.com 写道:
我发现
document.links(''link_id_here'')。href =" something" ;;
不适用于Firefox(即使是1.0.6)
这会给你一个错误document.links不是一个函数确实。
为什么你认为document.links是一个函数?
如果你真的有一个id为什么你不能简单地使用
document.getElementById(''link_id_here'')
?
-
Martin Honnen
http://JavaScript.FAQTs.com/
Martin Honnen schrieb:
******** @ gmail.com 写道:
我发现了
document.links(''link_id_here'')。href =" something" ;;
不适用于Firefox(即使是1.0.6)
这会给你一个错误document.links不是一个函数确实。
为什么你认为document.links是一个函数?
如果你真的有一个id为什么你不能简单地使用
document.getElementById(''link_id_here''' )
?
正确,document.links是一个数组,你可以通过ie获得单个元素
document.links [0]对于文档中的第一个链接,links-count在
document.links.length中,而href不称为hraf但是目标:
文档.links [0] .target。
您正在寻找的功能已由Martin Honnen发布,然后
您可以设置href by
document.getElementById(''link_id_here'')。setAttribu te(" href"," something");
Martin Kurz于2005年8月31日下午2:48发表以下文章:
Martin Honnen schrieb:
an ******** @ gmail.com写道:
我发现
document.links(''link_id_here'')。href =" something ;;
不适用于Firefox(即使是1.0.6)
给你一个错误document.links不是一个函数确实。
为什么你认为document.links是一个函数?
如果你真的有一个id为什么你不能简单地使用
document.getElementById(''link_id_here''' )
?
正确,document.links是一个数组,你可以通过ie
document.links [0]得到一个元素作为第一个链接文档,links-count在
document.links.length中,href不叫hraf但是目标:
document.links [0] .target。
您正在寻找的功能已由Martin Honnen发布,然后您可以通过
document.getElementById(''link_id_here'')设置href。setAttribu te(" ; href"," something");
并且想知道为什么它在大多数浏览器中都无法正常工作
自IE有setAttribute的主要问题吗?直接设置:
document.links [''linkNameNotID'']。href ="链接的新HREF" ;;
-
兰迪
comp.lang.javascript常见问题 - http://jibbering.com/faq &新闻组每周
答:它会破坏对话的顺序
问题:为什么?
答案:热门发布。
问题:Usenet上最烦人的事情是什么?
He there!
I''ve discovered that the
=================================================
document.links(''link_id_here'').href = "something";
=================================================
is not applicable for the Firefox (even for the 1.0.6), and I''m falling
into passing through the array and checking each link id.
Could anybody confirm it''s true and/or direct to a more elegant
solution if any?
Thanx,
Andrew
an********@gmail.com wrote:
I''ve discovered that the document.links(''link_id_here'').href = "something"; is not applicable for the Firefox (even for the 1.0.6)
That will give you an error "document.links is not a function" indeed.
Why do you think that document.links is a function?
And if you really have an id why don''t you simply use
document.getElementById(''link_id_here'')
?
--
Martin Honnen
http://JavaScript.FAQTs.com/
Martin Honnen schrieb:
an********@gmail.com wrote:I''ve discovered that the
document.links(''link_id_here'').href = "something";
is not applicable for the Firefox (even for the 1.0.6)
That will give you an error "document.links is not a function" indeed.
Why do you think that document.links is a function?
And if you really have an id why don''t you simply use
document.getElementById(''link_id_here'')
?
Correct, document.links is an array, you can get a single element by ie
document.links[0] for the first link in document, the links-count is in
document.links.length and the href isn''t called hraf but target:
document.links[0].target.
And the functionality you''re looking for has been posted by Martin Honnen, then
you can set the href by
document.getElementById(''link_id_here'').setAttribu te("href", "something");
Martin Kurz said the following on 8/31/2005 2:48 PM:
Martin Honnen schrieb:
an********@gmail.com wrote:
I''ve discovered that the
document.links(''link_id_here'').href = "something";
is not applicable for the Firefox (even for the 1.0.6)
That will give you an error "document.links is not a function" indeed.
Why do you think that document.links is a function?
And if you really have an id why don''t you simply use
document.getElementById(''link_id_here'')
?
Correct, document.links is an array, you can get a single element by ie
document.links[0] for the first link in document, the links-count is in
document.links.length and the href isn''t called hraf but target:
document.links[0].target.
And the functionality you''re looking for has been posted by Martin Honnen, then
you can set the href by
document.getElementById(''link_id_here'').setAttribu te("href", "something");
And wonder why it doesn''t work properly in the majority of browsers
since IE has major problems with setAttribute? Set it dierectly:
document.links[''linkNameNotID''].href="new HREF for the link";
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
这篇关于Javascript,Firefox和document.links的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!