IE中的innerHTML? [英] innerHTML in IE?

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

问题描述

我在使用innerHTML和我的收音机类型按钮时遇到了麻烦。

I'm having trouble using innerHTML with my radio type button.

<table align="center">
 <div class='main'>
  <span id="js" class='info'>
   <label><input type="radio" name="js" value="0" size="<?php echo $row['size']; ?>" onclick="js(this.value, this.size);" /><img src="arrowup.png"/></label>
   <br />
   <label><input type="radio" name="js" value="1" size="<?php echo $row['size']; ?>" onclick="js(this.value, this.size);" /><img src="arrowdown.png"/></label>
  </span>
 </div>
</table>

我的.js看起来像这样:

My .js looks like this:

var xmlhttp;

function getVote(a,b) {
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)   {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="js.php";
url=url+"?js="+a;
url=url+"&id="+b;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged() {

  if (xmlhttp.readyState==4) {
  document.getElementById("js").innerHTML=xmlhttp.responseText;
  }
}

function GetXmlHttpObject() {
var objXMLHttp=null;
if (window.XMLHttpRequest)   {
  objXMLHttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)   {
  objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
return objXMLHttp;
} 

这在IE中不起作用!任何帮助?

This doesn't work in IE only! Any help?

推荐答案

首先,非常确定直接在TABLE中的DIV是非法标记。

firstly, pretty sure a DIV directly inside a TABLE is illegal markup.

不要使用非法标记。浏览器会对它做出不同的反应(我最近让Opera忽略了一些非法的东西,IE试图渲染它)。

don't use illegal markup. browsers will respond differently to it (i've recently had Opera ignore some illegal stuff with IE trying to render it).

IE通常应该得到它,首先得到正确的标记,然后看看IE是如何做的。它可能无法像你期望的那样呈现DOM。

tho IE usually deserves it, firstly get the markup correct and then see how IE does. it may be that it has failed to render the DOM how you expect.

(FWIW有一个innerHTML渲染问题我遇到了IE, http://support.microsoft.com/kb/276228/ ,但对于SELECT元素,所以我不要认为这适用于此。)

(FWIW there is an innerHTML rendering problem i've run up against with IE, http://support.microsoft.com/kb/276228/, but for the SELECT element so i don't think it applies here).

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

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