document.getElementById(""").className = """";无法在 IE 中工作
我在这里创建了一个业务生成器:http://minespress.net/web_apps/business-cards/
我使用 document.getElementById("...").className = "...";
创建了一个预览窗格,它会在单击(缩略图的)时切换背景图像,并根据的设计名片。这在 FF、Chrome 和 Safari 中完美运行。当我在 IE 中尝试时,onClick 没有任何反应。
我还应该提到,我的拇指是单选按钮,需要根据是否选中它们来更改表单操作。再次在除 IE 之外的其他浏览器中运行良好。是否有一些 IE 错误或者我只是做了一些完全错误的事情?
这是我的代码的示例:
<input
style="display:none"
checked="checked"
name="group1"
id="2"
value='http://minespress.net/web_apps/business-cards/img/twinkle-blue.jpg'
type="radio"
onclick="document.getElementById('card').className ='Default'; document.getElementById('compname').className ='', document.getElementById('slogan').className ='', document.getElementById('leftinfo').className ='', document.getElementById('rightinfo').className =''" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
IE 8 不支持图像作为输入字段的标签。这就是我的单选按钮不起作用的原因。现在我只需要弄清楚如何解决这个问题。
IE 8 does not support images as labels for input fields. This is why my radio buttons do not work. Now I just need to figure out how to work around this.
使用 setAttribute 代替:
Use setAttribute instead:
您是否尝试将
,
更改为;
? IE 可能比其他浏览器更挑剔...更改
"document.getElementById('card').className ='Default'; document.getElementById('compname').className ='', document.getElementById('口号').className ='', document.getElementById('leftinfo').className ='', document.getElementById('rightinfo').className =''"
到
"document.getElementById('card').className ='Default'; document.getElementById('compname').className =''; .className =''; document.getElementById('leftinfo').className =''; document.getElementById('rightinfo').className =''"
看看是否如此解决你的问题。
Did you try changing the
,
s to;
s? IE might be pickier than the other browsers...Change
"document.getElementById('card').className ='Default'; document.getElementById('compname').className ='', document.getElementById('slogan').className ='', document.getElementById('leftinfo').className ='', document.getElementById('rightinfo').className =''"
to
"document.getElementById('card').className ='Default'; document.getElementById('compname').className =''; document.getElementById('slogan').className =''; document.getElementById('leftinfo').className =''; document.getElementById('rightinfo').className =''"
and see if that solves your problem.