自己解决了
贴代码:
function addEvent(obj, evt, fn) {
if (document.all) {
obj.attachEvent("on" + evt, function () {
fn.call(obj, window.event)
});
}
else {
obj.addEventListener(evt, fn, false);
}
}
KindEditor.ready(function (K) {
editor = K.create('textarea[name="content1"]', {
filterMode: false,
cssPath: '/Manage/js/kindeditor/plugins/code/prettify.css',
uploadJson: '/Manage/Server/UpMorePic.aspx?cmd=editor&wsid=<%=wsID%>&token=<%=token%>', ///Manage/js/kindeditor/asp.net/upload_json.ashx
fileManagerJson: '/Manage/js/kindeditor/asp.net/file_manager_json.ashx?wsid=<%=wsID%>&token=<%=token%>',
allowFileManager: true,
items: keExtend.items
});
addEvent(document.forms[0], "submit", function () {//对百度地图代码进行处理
var v = document.getElementById("content1").value;
if (v.indexOf("//创建InfoWindow") != -1) {
var sIndex = v.indexOf("//创建InfoWindow");
var eIndex = v.indexOf("//创建一个Icon");
var sStr = v.substring(0, sIndex);
var eStr = v.substring(eIndex, v.length - 1);
v = sStr + "\/\/创建InfoWindow\n";
v += "function createInfoWindow(i){\n";
v += "var json = markerArr[i];\n";
v += "var iw = new BMap.InfoWindow(\"<b class='iw_poi_title' title='\" + json.title + \"'>\" + json.title + \"</b><div class='iw_poi_content'>\"+json.content+\"</div>\");\n";
v += "return iw;\n";
v += "}\n";
v += eStr;
document.getElementById("content1").value = v;
}
});
});