iE8 下的JS 不兼容求解释!

dupeng88 2013-09-02 08:29:13
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ include file="/common/global.jsp"%>




<html>
<head>



<title>告警日志</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style>
.a {
width: 300px;
float: left;
margin-left: 30px;
}

.roomsearch {
float: right;
}
</style>
<script language="javascript">
var oCache = {
iCacheLower: -1
};


function fnSetKey( aoData, sKey, mValue )
{
for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
{
if ( aoData[i].name == sKey )
{
aoData[i].value = mValue;
}
}
}

function fnGetKey( aoData, sKey )
{
for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
{
if ( aoData[i].name == sKey )
{
//alert(aoData[i].value);
return aoData[i].value;
}
}
return null;
}

function fnDataTablesPipeline ( sSource, aoData, fnCallback, oSettings ) {

var iPipe = 5; /* Ajust the pipe size */
//alert(aoData);
var bNeedServer = false;
var sEcho = fnGetKey(aoData, "sEcho");
var iRequestStart = fnGetKey(aoData, "iDisplayStart");
var iRequestLength = fnGetKey(aoData, "iDisplayLength");
var iRequestEnd = iRequestStart + iRequestLength;
oCache.iDisplayStart = iRequestStart;
//alert(sEcho+"|"+iRequestStart+"|"+iRequestLength+"|"+iRequestEnd);
/* outside pipeline? */
if ( oCache.iCacheLower < 0 || iRequestStart < oCache.iCacheLower || iRequestEnd > oCache.iCacheUpper )
{
bNeedServer = true;
}

/* sorting etc changed? */
if ( oCache.lastRequest && !bNeedServer )
{
for( var i=0, iLen=aoData.length ; i<iLen ; i++ )
{
if ( aoData[i].name != "iDisplayStart" && aoData[i].name != "iDisplayLength" && aoData[i].name != "sEcho" )
{
if ( aoData[i].value != oCache.lastRequest[i].value )
{
bNeedServer = true;
break;
}
}
}
}

/* Store the request for checking next time around */
oCache.lastRequest = aoData.slice();
if ( bNeedServer )
{
if ( iRequestStart < oCache.iCacheLower )
{
iRequestStart = iRequestStart - (iRequestLength*(iPipe-1));
if ( iRequestStart < 0 )
{
iRequestStart = 0;
}
}

oCache.iCacheLower = iRequestStart;
oCache.iCacheUpper = iRequestStart + (iRequestLength * iPipe);
oCache.iDisplayLength = fnGetKey( aoData, "iDisplayLength" );
fnSetKey( aoData, "iDisplayStart", iRequestStart );
fnSetKey( aoData, "iDisplayLength", iRequestLength*iPipe );

oSettings.jqXHR = $.getJSON( sSource, aoData, function (json) {
// json={"sEcho":0,"iTotalRecords":"57","iTotalDisplayRecords":"57","aaData":


/* Callback processing */
oCache.lastJson = jQuery.extend(true, {}, json);

if ( oCache.iCacheLower != oCache.iDisplayStart )
{
json.aaData.splice( 0, oCache.iDisplayStart-oCache.iCacheLower );
}
json.aaData.splice( oCache.iDisplayLength, json.aaData.length );
fnCallback(json);
} );

}
else
{
json = jQuery.extend(true, {}, oCache.lastJson);
json.sEcho = sEcho; /* Update the echo for each response */
json.aaData.splice( 0, iRequestStart-oCache.iCacheLower );
json.aaData.splice( iRequestLength, json.aaData.length );
fnCallback(json);
return;
}
}
/* Table initialisation */
$(document).ready(function() {

var url = ctx+"/roomAlarm/roomalar";
//alert(url);
$('#roomTable').dataTable( {
"bProcessing": true,
"bServerSide": true,
//"sAjaxSource": ctx+"/common/arrays.txt",
"bLengthChange": false,
"sAjaxSource":url,
"fnServerData": fnDataTablesPipeline,
"bRetrieve": true,
aoColumnDefs : [


{"aTargets" : [3],"mRender" : function(data, type, full){
var rs = "<div style='width:100px;word-break:keep-all;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' title='"+data+"'>"+data+"</div>";
return rs;}},{"aTargets" : [4],"mRender" : function(data, type, full){
var tt=new Date(parseInt(data)).toLocaleString();
return tt;
}}],

"aoColumns": [

// { "mData": "alarmEventId" },
{ "mData": "alarmEventName" },
{ "mData": "alarmTypeString" },
{ "mData": "eventLevelString" },
{ "mData":"alEventContent"},
{ "mData":"createTime"},
],
"sDom": "<'row'<'a'l><'roomsearch'f>r>t<'row'<'a'i><'roomsearch'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "页显示_MENU_ 个数",
"sInfo":"从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
"sSearch":"检索:",
"sEmptyTable":"没有数据",
"sInfoEmpty": "显示0条数据",
"oPaginate":{
"sPrevious": "上一页",
"sNext":'下一页'
}


}
} );
} );
</script>
</head>



<body>

<div class="page-header">
<h2>告警日志</h2>
</div>

<table id="roomTable" cellpadding="0" cellspacing="0" border="0" class="table table-hover">
<thead>
<tr >

<th style='width:120px'>告警标题</th>
<th style='width:80px'>告警类型</th>
<th style='width:80px'>告警等级</th>
<th style='width:100px'>告警内容</th>
<th style='width:200px'>告警时间</th>
</tr>
</thead>


</table>



</body>

</html>
...全文
222 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dupeng88 2013-09-06
  • 打赏
  • 举报
回复
{ "mData":"createTime"},此处多出逗号!!!!
枫醉秋 2013-09-02
  • 打赏
  • 举报
回复
lz能不能具体到那一段呀
conanhhy 2013-09-02
  • 打赏
  • 举报
回复
LZ指的是哪一段JS不兼容?是全部的代码?

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧