简体   繁体   English

从javascript生成的标签在mozilla firefox中不起作用

[英]Labels generated from javascript are not working in mozilla firefox

I am creating labels using javascript in my work.It is working fine in google chrome but its not working in Mozilla firefox. 我在工作中使用javascript创建标签。它在google chrome中可以正常工作,但在Mozilla firefox中不起作用。 And the version of firefox is 4.0 which is latest one..bu still its not working..what is the solution for this? 并且firefox的版本是4.0,这是最新版本。.bu仍然无法正常工作..解决方案是什么? Here is example code...Like this there are so many situations where i create labels in js.But firefox is not supprorting..why? 这是示例代码...就像这样,在我用js创建标签的情况如此之多的情况下,但是firefox却没有支持..为什么? Help me pls...Example code is:- 帮帮我...示例代码是:-

var placeHereHeader=document.getElementById("placeLabel");
var HeadLabel=document.createElement("label");
HeadLabel.setAttribute("id","LabelHeader");
placeHereHeader.appendChild(HeadLabel);

This is an old question, but never answered. 这是一个古老的问题,但从未得到回答。

http://jsfiddle.net/bL6sf/ shows it indeed works, but I have the newer version than Firefox 4.0. http://jsfiddle.net/bL6sf/表示确实可以,但是我的版本比Firefox 4.0更新。

Maybe you didn't see the label because you didn't put any text or html inside it? 也许您没有看到标签是因为您没有在其中放置任何文本或html?

var placeHereHeader=document.getElementById("placeLabel");
var HeadLabel=document.createElement("label");
HeadLabel.innerHTML = "My kickass label";
HeadLabel.setAttribute("id","LabelHeader");
placeHereHeader.appendChild(HeadLabel);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM