[英]javascript and IExplorer
function getEntry(time)
{
var newdiv = document.createElement("div");
if(time=='120')
{
var container = document.getElementById('require');
newdiv.innerHTML = "<tr id='a'><td><input type='radio' name='type' value='001' onchange='getRadioCheckedValue();' checked>Resume Writing<input type='hidden' name='service' id='1_59.95' value='Resume Writing'> </td><td><input type='hidden' name='price' value='59.95'>$59.95</td></tr>";
container.appendChild(newdiv);
}
i get nothing on the browser when i run this function...it works fine in firefox but noting happens on IE...no errors either. 当我运行此功能时,我在浏览器上什么也没得到...在Firefox中可以正常工作,但请注意在IE上发生...也没有错误。
can someone please explin how to fix this. 有人可以解释一下如何解决此问题。
Thanks. 谢谢。
You also need to add newdiv
to body
: 您还需要将
newdiv
添加到body
:
document.body.appendChild(newdiv);
I also suspect id value like 1_59.95
with a point in between doesn't seem to be all right at least for the IE. 我还怀疑ID值(例如
1_59.95
之间有一个点,至少对于IE来说似乎不正确。
The HTML you are injecting is bad formatted, meaning you have no closing tags on inputs /> (FF tries to help you and close the input tags however he sees fit) and a property with no value: "checked". 您要插入的HTML格式错误,这意味着您在输入/>上没有关闭标签(FF会尝试帮助您并在他认为合适的情况下关闭输入标签),并且没有值:“ checked”。 IE translates checked to checked="checked".
IE将checked转换为checked =“ checked”。
As for the "adding" part I don't see an issue there as long as container actually is an HTML element. 至于“添加”部分,只要容器实际上是HTML元素,我就看不到任何问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.