主题: 在asp.net中使用问题,且报错。
作者: 微笑, 发布日期: 2011-12-13 15:35:34, 浏览数: 4939

我的页面代码,使用了模版页

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="../Css/Admin/news_Add.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="../kindeditor/themes/default/default.css" />
	<link rel="stylesheet" href="../kindeditor/plugins/code/prettify.css" />
	<script charset="utf-8" src="../kindeditor/kindeditor.js"></script>
	<script charset="utf-8" src="../kindeditor/lang/zh_CN.js"></script>
	<script charset="utf-8" src="../kindeditor/plugins/code/prettify.js"></script>
    <script defer="defer">
        KindEditor.ready(function (K) {
            var editor1 = K.create('<%=content1.ClientID %>', {
                cssPath: '../../plugins/code/prettify.css',
                uploadJson: '../../upload_json.ashx',
                fileManagerJson: '../../file_manager_json.ashx',
                allowFileManager: true,
                afterCreate: function () {
                    var self = this;
                    K.ctrl(document, 13, function () {
                        self.sync();
                        //document.forms[0].submit();
                    });
                    K.ctrl(self.edit.doc, 13, function () {
                        self.sync();
                        //document.forms[0].submit();
                    });
                }
            });
            prettyPrint();
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">    
    <textarea id="content1" cols="100" rows="8" style="width:700px;height:200px;visibility:hidden;" runat="Server"></textarea>        <asp:Button ID="Button1" runat="Server" Text="提交内容" /> (提交快捷键: Ctrl + Enter)        
</asp:Content>

页面浏览的时候,就报下面这样的错,请问是怎么回事?

function _create(expr, options) {
	options = options || {};
	options.basePath = _undef(options.basePath, K.basePath);
	options.themesPath = _undef(options.themesPath, options.basePath + 'themes/');
	options.langPath = _undef(options.langPath, options.basePath + 'lang/');
	options.pluginsPath = _undef(options.pluginsPath, options.basePath + 'plugins/');
	if (_undef(options.loadStyleMode, K.options.loadStyleMode)) {
		var themeType = _undef(options.themeType, K.options.themeType);
		_loadStyle(options.themesPath + 'default/default.css');
		_loadStyle(options.themesPath + themeType + '/' + themeType + '.css');
	}
	function create(editor) {
		_each(_plugins, function(name, fn) {
			fn.call(editor, KindEditor);
		});
		return editor.create();
	}
	var knode = K(expr);
	if (!knode) {
		return;
	}
	options.srcElement = knode[0];
	if (!options.width) {
		options.width = knode[0].style.width || knode.width();
	}
	if (!options.height) {
		options.height = knode[0].style.height || knode.height();
	}
	var editor = new KEditor(options);
	if (_language[editor.langType]) {
		return create(editor);
	}
	_loadScript(editor.langPath + editor.langType + '.js?ver=' + encodeURIComponent(K.DEBUG ? _TIME : _VERSION), function() {
		return create(editor);
	});
	return editor;
}

上面的代码是kindeditor.js中的,在这行报错了
错误: 无法获取属性“style”的值: 对象为 null 或未定义

if (!options.width) {
		options.width = knode[0].style.width || knode.width();
	}
求解答,加急!
作者: Roddy, 发布日期: 2011-12-14 00:16:39
// K.create第一个参数可能不对,第一个参数是#加textarea的ID
KindEditor.ready(function (K) {
            var editor1 = K.create('#content1', {
回复
作者: 微笑, 发布日期: 2011-12-14 14:29:44

回复Roddy:#加上textarea的id,那么textarea是服务器控件时,这里的id应如何写?

var temp = '<%=content.ClientID %>';

editor = K.create( document.getElementById(temp).id, {......这样不行滴

回复
发表新帖 发表回复