<img src="" alt="" id="ipc">
<input name="showpic" onchange="view(this)" type="text" size="40" value="" readonly="readonly"  />
<script type="text/javascript">
function view(obj){
    var src="";
    if(document.all){
        obj.select();
        src = document.selection.createRange().text;
        document.selection.empty();
        if(/\.(gif|jpg|jpeg|png|bmp)/i.test(src)){
            document.getElementById("ipc").src=src;
        }else{
            alert("请选择图片!");
        }
    }else{
        var file=obj.files[0];        src=window.createObjectURL&&window.createObjectURL(file)||window.URL&&window.URL.createObjectURL(file)||window.webkitURL && window.webkitURL.createObjectURL(file);
        document.getElementById("ipc").src=src;
    }
}
</script>

解决方案 »

  1.   


    <link href="http://127.0.0.1/static/plugins/editor/themes/default/default.css" rel="stylesheet"></link><script src="http://127.0.0.1/static/plugins/editor/kindeditor.js" charset="utf-8"></script><script src="http://127.0.0.1/static/plugins/editor/lang/zh_CN.js" charset="utf-8"></script><script src="http://127.0.0.1/static/plugins/editor/plugins/code/prettify.js" charset="utf-8"></script>                            KindEditor.ready(function(K) {
                                                var editorpic = K.editor({
                                                    allowFileManager : true
                                                });
                                                K("#image").click(function() {
                                                    editorpic.loadPlugin("image", function() {
                                                        editorpic.plugin.imageDialog({
                                                            imageUrl : K("#showpic").val(),
                                                            clickFn : function(url, title, width, height, border, align) {
                                                            K("#showpic").val(url);
                                                            editorpic.hideDialog();
                                                        }
                                                        });
                                                    });
                                                });
        }); 这样要如何改造?
      

  2.   


    <link href="http://127.0.0.1/static/plugins/editor/themes/default/default.css" rel="stylesheet"></link><script src="http://127.0.0.1/static/plugins/editor/kindeditor.js" charset="utf-8"></script><script src="http://127.0.0.1/static/plugins/editor/lang/zh_CN.js" charset="utf-8"></script><script src="http://127.0.0.1/static/plugins/editor/plugins/code/prettify.js" charset="utf-8"></script>                            KindEditor.ready(function(K) {
                                                var editorpic = K.editor({
                                                    allowFileManager : true
                                                });
                                                K("#image").click(function() {
                                                    editorpic.loadPlugin("image", function() {
                                                        editorpic.plugin.imageDialog({
                                                            imageUrl : K("#showpic").val(),
                                                            clickFn : function(url, title, width, height, border, align) {
                                                            K("#showpic").val(url);
                                                            editorpic.hideDialog();
                                                        }
                                                        });
                                                    });
                                                });
        }); 这样要如何改造?