AJAX在对容器内容更改时innerHTML,IE出现未知运行时错误 - Web 开发 / Ajax
HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>积客软件 - 搜索</title>
<meta name="keywords" content="积客软件,积客CMS系统,积客内容管理系统" />
<meta name="description" content="积客软件长期专注于中小型企业电子商务产品研发。" />
<meta name="generator" content="积客(Jacksoft)内容管理系统 V1.0.0_110920_beta" />
<meta name="author" content="Jack.Hu" />
<meta name="copyright" content="2005-2011 Jacksoft,All Rights Reserved." />
<meta name="MSSmartTagsPreventParsing" content="True" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="MSThemeCompatible" content="Yes" />
<meta http-equiv="x-ua-compatible" content="ie=7" />
<script language="javascript" type="text/javascript" src="http://localhost/cms/jacksoft/js/ajax.js"></script>
<script language="javascript">
function submitSearch()
{
var sUrl = "?type=&cate=&word=" + encodeURIComponent($('word').value);
location.href = sUrl;
}
function selectKeyword(w)
{
var sUrl = "?type=&cate=&word=" + w;
location.href = sUrl;
}
function inputChange()
{
var sWord = encodeURIComponent($('word').value);
jacksoftAjax.post(ROOT_PATH+'ajax.php?mod=jacksoft&op=keywords&word='+sWord,'',
function(x)
{
var sBackText = x.responseText;
if(sBackText!='')
{
$("keywords").style.display = '';
$("keywords").innerHTML = sBackText;/////////错误在这里
}
else
{
$("keywords").style.display = 'none';
}
}
);
}
document.onkeydown = function(e)
{
e = e ? e : window.event;
var iCode = e.which ? e.which : e.keyCode;
if(iCode == 13)
{
submitSearch();
}
}
</script>
</head>
<body>
<div class="logo">
<img src="http://localhost/cms/file/logo.png">
</div>
<div class="searchBox">
<div class="tabs">
<ul>
<li class="on"><a href="?type=&cate=text&word=">文本</a></li>
<li class="out"><a href="?type=&cate=image&word=">图片</a></li>
<li class="out"><a href="?type=&cate=audio&word=">音频</a></li>
<li class="out"><a href="?type=&cate=video&word=">视频</a></li>
<li class="out"><a href="?type=&cate=file&word=">文件</a></li>
</ul>
</div>
<div class="input">
<div class="left"></div>
<div class="middle">
<div><input class="text" type="text" value="" name="word" id="word" onkeyup="inputChange()" /></div>
<div id="keywords" style="display:none;"></div>
</div>
<div class="right">
<a class="button" href="javascript:submitSearch();"></a>
</div>
</div>
</div>
<!--Search List-->
<!--Search List End-->
<div id="footer">
Copyright © 2011,All Rights Reserved.
</div>
</body>
</html>