锚的FireFox问题(a) [英] FireFox issue with Anchor(a)

查看:94
本文介绍了锚的FireFox问题(a)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在制作一个应用程序,其中必须使用JS
动态创建一些锚点. 该代码在IE和chrome上运行正常,但现在在Firefox上运行,甚至没有显示任何错误消息

Hi,
I am making an application in which i have to make some anchors dynamically using JS
The code is working fine on IE and chrome but it is now working on Firefox its not even showing any error message

var link = document.createElement('a');
               link.innerText = "Go here";
               link.setAttribute('onclick', 'removeElement(' + divIdName + ')');
               link.setAttribute('style', 'font-size: 120%;font-weight: bold');
               link.setAttribute('id', 'removelnk');


newdiv.appendChild(link);

               alert(link.innerText);




它正在创建链接,但未显示其文本,即转到此处
我已使用警报显示链接的内部文本,并且显示正确.




it is creating the link but its not displaying its text ie Go here
I have used an alert to show link''s innertext and it is showing properly

推荐答案

检查这些博客
http://mayiknow.blogspot.com/2010/07/anchor-not-working-in-firefox-crome-and.html [ http://stackoverflow.com/questions/4884498/anchor-tag- not-working-in-firefox-and-chrome [ ^ ]
http://bytes.com/topic/html-css/answers/454721-ff-anchor-links-not-working [ ^ ]
--NDK
check these blogs
http://mayiknow.blogspot.com/2010/07/anchor-not-working-in-firefox-crome-and.html[^]
http://stackoverflow.com/questions/4884498/anchor-tag-not-working-in-firefox-and-chrome[^]
http://bytes.com/topic/html-css/answers/454721-ff-anchor-links-not-working[^]
--NDK


Firefox不支持innerText属性.为此,您将使用textContent.还有,innerHTML.

我个人发现,像jQuery这样的库对浏览器问题有很大帮助.这可能对您无效,只是一个想法
Firefox does not support the innerText property. For that you would use textContent. Also, innerHTML.

I personally have found that a library like jQuery helps quite a bit with browser issues. That may not be valid for you, just a thought


这篇关于锚的FireFox问题(a)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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