日期:2014-05-17  浏览次数:20885 次

编辑器上传图片路径问题
<IMG src="http://www.zhenghangplc.com/uploadfiles/201282111533867627.jpg">
这是通过编辑器上传图片路径

但是中间少了一个文件夹
<IMG src="http://www.zhenghangplc.com/adminkk/uploadfiles/201282111533867627.jpg">
这样才对,



下面是图片上传的JS代码,麻烦问一下那里出错了。
<script language="JavaScript">
<!--
window.isIE = (navigator.appName == "Microsoft Internet Explorer");
if(window.isIE) {
if(navigator.userAgent.indexOf("Opera")>-1) window.isIE = null;
}
else {
if(navigator.userAgent.indexOf("Gecko")==-1) window.isIE = null;
}
function $(sID) {
return document.getElementById(sID);
}
function adjustDialog(){
var w = $("tabDialogSize").offsetWidth + 6;
var h = $("tabDialogSize").offsetHeight + 25;
window.dialogLeft = (screen.availWidth - w) / 2;
window.dialogTop = (screen.availHeight - h) / 2;
}
window.onload = init;
function init () {
adjustDialog();
$("imgpath").select();
}
function chk_imgpath () {
var editor = window.dialogArguments.EDiaryEditor;
var oRTE = editor.iframe.contentWindow;
if($("imgpath").value == "http://" || $("imgpath").value == "") {
window.close();
return;
}
var html = "<img src='" + $("imgpath").value + "'>";
if(window.isIE) {
try{
oRTE.focus();
var oRng = oRTE.document.selection.createRange();
oRng.pasteHTML(html);
oRng.collapse(false);
oRng.select();
}
catch(e){}
}
else {
editor.runCMD('insertHTML', html);
}
window.close();
}
document.onkeydown = function (el) {
var event = window.event || el;
if(event.keyCode == 13) {
chk_imgpath();
}
}
//-->
</script>

------解决方案--------------------
那你自己加上那个不就对了?
window.parent.document.getElementById('imgpath').value='adminkk/"&FileName&"';