在IE中设置选择框的innerHtml [英] Setting innerHtml of a selection box in IE

查看:131
本文介绍了在IE中设置选择框的innerHtml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网站上有一种情况需要追加新的< //选项>标记到特定选择框。我正在做以下事情:

On my website there is a situation where I need to append new < //option> tags to a specific selection box. I am doing the following:

1.发出ajax请求,返回选项标签,如

1.Make an ajax request which returns option tags like

 <option>one</option>

 <option>two</option>

等。

2.Set

 document.getElementById("id").innerHTML=response;

它在firefox / chrome中效果很好但在IE中却不行....

it works well in firefox/chrome but not in IE....

任何已知的解决方案.. ??

any known solution for this..??

推荐答案

这是一个已知的IE错误。您可以使用DOM方法追加/替换选项元素,也可以使用 Microsoft建议的解决方法,其中一个是将你的选择包装在div中并将div的innerHTML设置为< select>< option> ...

It's a known IE bug. You can either user DOM methods to append/replace the option elements, or you can use the workarounds suggested by Microsoft, one of which is to wrap your select in a div and set the div's innerHTML to "<select><option>..."

这篇关于在IE中设置选择框的innerHtml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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