开发者

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'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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.

can someone please explin how to fix this.

Thanks.


You also need to add newdiv to 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.


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". IE translates checked to checked="checked".

As for the "adding" part I don't see an issue there as long as container actually is an HTML element.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜