主题: 与iframe有冲突 --- 演示代码
作者: peace, 发布日期: 2011-08-29 15:53:45, 浏览数: 5681

 

主题: 惊天大BUG,与iframe有冲突,请官方仔细检查

http://www.kindsoft.net/view.php?bbsid=4&postid=3541&pagenum=1
作者: wozhaoying, 发布日期: 2011-08-17 18:24:00, 浏览数: 96

演示代码 看回复[ 回复Roddy ] --- [ 作者: peace, 发布日期: 2011-08-29 15:50:05  ]:

 

bugedit.htm

 

 <html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>后台管理中心</title>
<link href="../../inc/adm_inc/adm_style.css" rel="stylesheet" type="text/css">
<script src="../../inc/home/jsInfo.js" type="text/javascript"></script>
<link href='/php/sadm/edkind/themes/default/default.css' rel='stylesheet' />
<link href='/php/sadm/edkind/plugins/code/prettify.css'  rel='stylesheet' />
<script src='/php/sadm/edkind/kindeditor.js'          type='text/javascript' charset='utf-8'></script>
<script src='/php/sadm/edkind/lang/zh_CN.js'              type='text/javascript' charset='utf-8'></script>
<script src='/php/sadm/edkind/plugins/code/prettify.js'   type='text/javascript' charset='utf-8'></script>
<script src='/php/sadm/edkind/_config.js'                 type='text/javascript' charset='utf-8'></script>
</script>
<style type="text/css"> 
tr, td {
	background-color:#FFF;
}
</style>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="F0F0F0">
  <form name="fm01" id="fm01" action="?" method="post">
    <tr>
      <td align="center"><p>&nbsp;</p></td>
      <td align="center"><strong>[备用图片]编辑</strong></td>
    </tr>
    <tr>
      <td align="center" nowrap>主题</td>
      <td><input name="InfSubj" type="text" id="InfSubj" value="wwedd" size="60" maxlength="120">
          <select name='SetSubj' size=1 class="Input_Text" id="SetSubj" style="width:90 ">
            <OPTION style='COLOR:#000000; BACKGROUND-COLOR:#000000' value='000000'>#000000</OPTION>
            <OPTION style='COLOR:#000000; BACKGROUND-COLOR:#000000' value='000000'>#000000</OPTION>
            <OPTION style='COLOR:#FF0000; BACKGROUND-COLOR:#FF0000' value='FF0000'>#FF0000</OPTION>
            <OPTION style='COLOR:#00FF00; BACKGROUND-COLOR:#00FF00' value='00FF00'>#00FF00</OPTION>
            <OPTION style='COLOR:#0000FF; BACKGROUND-COLOR:#0000FF' value='0000FF'>#0000FF</OPTION>
            <OPTION style='COLOR:#00FFFF; BACKGROUND-COLOR:#00FFFF' value='00FFFF'>#00FFFF</OPTION>
            <OPTION style='COLOR:#FF00FF; BACKGROUND-COLOR:#FF00FF' value='FF00FF'>#FF00FF</OPTION>
            <OPTION style='COLOR:#FFFF00; BACKGROUND-COLOR:#FFFF00' value='FFFF00'>#FFFF00</OPTION>
          </select>
      </td>
    </tr>
    <tr>
      <td align="center" nowrap></td>
      <td><select name="InfType" id="InfType">
        <option value=''>┯ [ROOT]:::不限:::</option>
<option value='TB10012;'  selected >│ ├─收集图片</option>
<option value='TB10016;' >│ ├─备用图片</option>      </select>
        <input name=Button type=button id="Button2" value="选择模板" onClick="owTemp()" />
&nbsp; &nbsp;
  		</td>
    </tr>
    <input type='hidden' name='KeyCode' id='KeyCode' value='8W85Q0-CMS8N0'> 
    <tr>
      <td align="center">内容</td>
      <td>
<textarea id="InfCont" name="InfCont" style="width:600px;height:360px;visibility:hidden;display:none">&lt;p&gt;
	(内容可不填写) 以下是提示:
&lt;/p&gt;
&lt;p&gt;
	(...Test...)&lt;br /&gt;
1. 在附图处上传图片;&lt;br /&gt;
2. 图片请不要太大, &lt;span style=&quot;color:#ff0000;&quot;&gt;50K&lt;/span&gt;以内,否则前台打开会很慢;dddddddd
&lt;/p&gt;</textarea>
<script type="text/javascript">
 var EditID01; //放在.ready外面
KindEditor.ready(function(K) {
  document.getElementById('InfCont').style.display = ''; 
  EditID01 = K.create('#InfCont', {
	cssPath : '../plugins/code/prettify.css',
	newlineTag : 'p',
	uploadJson : '/php/smod/file/edt_up.php',
	fileManagerJson : '/php/smod/file/edt_view.php', 
	allowFileManager : true,
	emoticonsPath : '/php/img/',
	items : itemdef
  });   //放在.ready里面
}); 
function apiGetValEditID01(){
  return EditID01.html(); //EditID01.sync();
}
function apiSetValEditID01(Val){
  EditID01.html(Val);
}
function apiSetVIDEditID01(id){
  EditID01.html(document.getElementById(id).innerHTML);
}
</script>
      </td>
    </tr>
    <tr>
  <td align="center" nowrap="nowrap">关键字</td>
  <td><input name="InfPara1" type="text" id="InfPara1" size="48" maxlength="120" />
  <input type="button" name="btnGetKeys" value="自动获取" onClick="setKeys()" id="btnGetKeys">
  </td>
</tr>
<tr>
  <td align="center">来源</td>
  <td><input name="InfPara2" type="text" id="InfPara2" value="本站:peace" size="60" maxlength="120"></td>
</tr> 
    <tr>
      <td align="center">属性</td>
      <td><select name="SetHot" id="SetHot">
        
<option  selected  value='N'>平常</option>
<option  value='Y'>推荐</option>      </select>
        <select name="SetShow" id="SetShow">       
          
<option  selected  value='Y'>审核</option>
<option  value='N'>未审</option>        </select>
        <select name="SetTop" id="SetTop">
          <option value="888" selected >顺序</option>
          
<option  value='0'>0</option>
<option  value='1'>1</option>
<option  value='2'>2</option>
<option  value='3'>3</option>
<option  value='4'>4</option>
<option  value='5'>5</option>
<option  value='6'>6</option>
<option  value='7'>7</option>
<option  value='8'>8</option>
<option  value='9'>9</option>        </select>
         &nbsp; &nbsp; 
        时间
        <input name="LogATime" type="text" id="LogATime" value="2011-08-29 07:11:18" size="20" maxlength="20">        &nbsp; <a href="../file/img_list.php?send=PicList&ID=dtpic-2011-8W-7VPV.N2QKQ" target="_blank">附件管理</a></td>
    </tr>
        <tr>
      <td align="center" nowrap>附图</td>
      <td>
        <IFRAME marginWidth=0 marginHeight=0 type="text/javascript" charset="utf-8"
          src="bugimg.htm?TabID=InfoPics&upPath=dtpic-2011-8W-7VPV.N2QKQ&ID=dtpic-2011-8W-7VPV.N2QKQ&NO=1"
          width="420" height='24' frameBorder=0 scrolling=no>
        </IFRAME>
      </td>
    </tr>
        <tr>
      <td align="center" nowrap><input name="yAct" type="hidden" id="yAct" value="Edit">      </td>
      <td><input name=view type=button id="Button1" value="确    定" onClick="chkData()">
        <input name=view type=reset id="Button1" value="重    写">
        <input name="KW" type="hidden" id="KW" value="">
        <input name="TP" type="hidden" id="TP" value="">
        <input name="TP2" type="hidden" id="TP2" value="">
        <input name="PG" type="hidden" id="PG" value="1">
        <input name="ID" type="hidden" id="ID" value="dtpic-2011-8W-7VPV.N2QKQ">
      <input name="PrmFlag" type="hidden" id="PrmFlag" value=""></td>
    </tr>
  </form>
</table>
 
 
<script type="text/javascript"> 
 
var tmpCont = "";
var fm = document.fm01;
 
function owTemp()
{
  var opt = fm.InfType;
  var typ = fm.InfType.value;
  window.open("set_temp.php?tMod=PicTBak&tTyp="+typ+"");
}
 
var xFile,xSize;
function owFileGet()
{
	  var tFile = xFile; 
	  var nPos = tFile.indexOf('/upfile/');
	  var sSub = tFile.substring(0,nPos);
	  tFile = tFile.replace(sSub,''); 
	  fm.InfPara7.value = tFile;
	  nPos = tFile.indexOf('.');
	  sSub = tFile.substring(0,nPos);
	  tFile = tFile.replace(sSub,''); 
	  fm.InfPara3.value = tFile;
	  fm.InfPara4.value = xSize;
}
 
aPara = "^^本站:peace^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^".split("^");
for(i=0;i<96;i++) {
  try{
	eval("fm.InfPara"+i).value = aPara[i];
  } catch (er) { }
}
 
function getTemp() //uptTemp() 
{
	apiSetValEditID01(tmpCont);
}
 
function chkData()
{
       
	   var eflag = 0;
       for(i=0;i<1;i++)
         {  ////////// //////////////// Start For ////////////////
 if (fm.InfSubj.value.length==0) 
   {   
     alert(" 主题 不能为空!"); 
     fm.InfSubj.focus();
     eflag = 1; break;
   }
   
   fm.InfCont.value = apiGetValEditID01(); 
 if (fm.InfCont.value.length==0) 
   {   
     //alert(" 内容 不能为空!"); 
     //eflag = 1; break;
   } 
   
 if (fm.InfCont.value.length>=480000) 
   {   
     alert(" 内容 不能超过 480 K字!"); 
     eflag = 1; break;
   }
 
         }  ////////// //////////////// End For //////////////////
         if (eflag==0){ 
		 fm.submit();
		 }
}
 
</script>
 
</body>
</html>

 

 


bugimg.htm

 

 <html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>后台管理中心</title>
<link href="../../inc/adm_inc/adm_style.css" rel="stylesheet" type="text/css">
<script src="../../inc/home/jsInfo.js" type="text/javascript"></script>
<script src="../../inc/home/jsInfo.js" type="text/javascript"></script>
</head>
<body>
<table height="100%" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="F0F0F0">
  <form name="ffimg1" id="ffimg1" action="img_up.php" enctype="multipart/form-data" method="post">
        <tr bgcolor="#FFFFFF">
      <td nowrap bgcolor="#FFFFFF"><input type='file' name='ImgName' style="width:360px; ">
        <input name=view type=submit id="Button1" value="上传">
        <input name="TabID" type="hidden" id="TabID" value="InfoPics">
        <input name="upPath" type="hidden" id="upPath" value="dtpic/2011/8W/7VPV.N2QKQ">
        <input name="ID" type="hidden" id="ID" value="dtpic-2011-8W-7VPV.N2QKQ">
        <input name="KeyID" type="hidden" id="KeyID" value="KeyID">
        <input name="ColID" type="hidden" id="ColID" value="ImgName">
        <input name="NO" type="hidden" id="NO" value="1">
        <input name="WW" type="hidden" id="WW" value="360">
      </td>
    </tr>
      </form>
</table>
</body>
</html>

 

 

 


以上正确,如果去掉
type="text/javascript" 则错误!

 

 

作者: peace, 发布日期: 2011-08-29 16:36:30

另:_config.js 文件

 

/*******************************************************************************
* KindEditor - WYSIWYG HTML Editor for Internet
* Copyright (C) 2006-2011 kindsoft.net
*
* @author Peace <QQ:80893510>
*******************************************************************************/

itemdef = [
  'source', 'undo', 'redo', '|', 
  'preview', 'print', 'template', 'paste', 'plainpaste', 'wordpaste', '|', 
  'justifyleft', 'justifycenter', 'justifyright','justifyfull', '|',
  'insertorderedlist', 'insertunorderedlist',  'indent', 'outdent', '|', 
  'subscript', 'superscript', 'clearhtml', 'quickformat', 'selectall', 'fullscreen', 
  '/',
  'formatblock', 'fontname', 'fontsize', 'forecolor', 'hilitecolor', '|', 
  'bold', 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|',
  'emoticons', 'table', 'hr', 'map', 'link', 'unlink', 'peaceMore', '|', 
  'image', 'flash', 'media', 'insertfile'
];
  
itemmin = [
  'source', 'fontname', 'fontsize', '|', 
  'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'removeformat', '|',    
  'image', 'link', 'peaceMMin', '|', 
  'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist','insertunorderedlist'
];


KindEditor.lang({ peaceMore : '更多&lt;&lt;&lt;' });
KindEditor.plugin('peaceMore', function(K) {
	var self = this, name = 'peaceMore';
	function click(value) {
		var cmd = self.cmd;
		if (value === 'adv_strikethrough') {
			cmd.wrap('<span style="background-color:#e53333;text-decoration:line-through;"></span>');
		} else {
			cmd.wrap('<span class="' + value + '"></span>');
		}
		cmd.select(); self.hideMenu();
	}
	self.clickToolbar(name, function() {
		var menu = self.createMenu({ name : name, width : 120 });
		// self.insertHtml('<em>测试</em>'); .exec('unlink'); .clickToolbar('about'); 
		var mitm = "print,cut,copy,paste,unlink,hr,code,pagebreak,about".split(',');
		var mmsg = "打印,剪切,复制,粘贴,取消(link),横线,代码,分页(page),关于".split(',');
		//for(mi=0;mi<mitm.length;mi++){
		  //var mact = mitm[mi]; var mflg = mmsg[mi]; if(mflg.indexOf("(")<=0) mflg += "("+mact+")";
		  //menu.addItem({ title : mflg, click : function() { self.clickToolbar(mact); } });
		//}
		menu.addItem({ title : '剪切(cut)',     click : function() { self.clickToolbar('cut');          } });
		menu.addItem({ title : '复制(copy)',    click : function() { self.clickToolbar('copy');         } });
		//menu.addItem({ title : '横线(hr)',      click : function() { self.clickToolbar('hr');            } });
		menu.addItem({ title : '代码(code)',    click : function() { self.clickToolbar('code');          } });
		menu.addItem({ title : '分页(page)',    click : function() { self.clickToolbar('pagebreak');     } });
		menu.addItem({ title : '关于(about)',   click : function() { self.clickToolbar('about');         } });
	});
});


KindEditor.lang({ peaceMMin : '更多&lt;&lt;&lt;' });
KindEditor.plugin('peaceMMin', function(K) {
	var self = this, name = 'peaceMMin';
	function click(value) {
		var cmd = self.cmd;
		if (value === 'adv_strikethrough') {
			cmd.wrap('<span style="background-color:#e53333;text-decoration:line-through;"></span>');
		} else {
			cmd.wrap('<span class="' + value + '"></span>');
		}
		cmd.select(); self.hideMenu();
	}
	self.clickToolbar(name, function() {
		var menu = self.createMenu({ name : name, width : 120 });
		menu.addItem({ title : '纯文本粘贴',  click : function() { self.clickToolbar('plainpaste');     } });
		menu.addItem({ title : '横线(hr)',    click : function() { self.clickToolbar('hr');             } });
		menu.addItem({ title : '全屏(full)',  click : function() { self.clickToolbar('fullscreen');     } });
		//menu.addItem({ title : '源代码',      click : function() { self.clickToolbar('source');         } });
		menu.addItem({ title : '关于(about)', click : function() { self.clickToolbar('about');          } });
	});
});

 

回复
作者: Roddy, 发布日期: 2011-08-29 21:38:01
应该和iframe没关系,请仔细调试,找出问题原因。
回复
作者: longlong, 发布日期: 2011-09-15 22:12:57

val = el.getAttribute(key, 2);

 不支持

我也碰上了这个问题

回复
作者: longlong, 发布日期: 2011-09-16 08:06:22

回复longlong:

在ie6里面没有问题,在ie8里面就有了

回复
作者: Roddy, 发布日期: 2011-09-16 09:04:14
SVN上的代码已经修复了此问题。
回复
发表新帖 发表回复