做了一个在线编辑器程序
index.html主要内容是点击添加图片,弹出一个层,上传本地图片,调用upload.jsp上传后返回上传图片的地址显示
结果出现window.parent.insertimg is not a function错误
index.html主要内容如下
function insertimg(imgpath){
var sPhoto = imgpath;
if ((sPhoto != null) && (sPhoto != "http://")) {
format("InsertImage", sPhoto);
}
}
<div id="divInsertImg" class="eMenu">
<form name="form1" id="form1" method="post" action="upload.jsp" enctype="multipart/form-data" target="myiframe">
<div style="margin:4px;"> 插入图片 </div>
<input type="file" name="file1" id="file1" style="width:235px; border:#7E9DB9 1px solid"><br />
<input type="submit" style="margin:4px;" value="确定">
<input type="reset" style="margin:4px;" onclick="calcelimg();" value="取消" >
</form>
</div>upload.jsp最后一句如下
<script>window.parent.insertimg('<%=largepic%>');</script>
应该是这句,不能把图片地址反回到index.html中的JS函数中去,请教高手如何修改。
index.html主要内容是点击添加图片,弹出一个层,上传本地图片,调用upload.jsp上传后返回上传图片的地址显示
结果出现window.parent.insertimg is not a function错误
index.html主要内容如下
function insertimg(imgpath){
var sPhoto = imgpath;
if ((sPhoto != null) && (sPhoto != "http://")) {
format("InsertImage", sPhoto);
}
}
<div id="divInsertImg" class="eMenu">
<form name="form1" id="form1" method="post" action="upload.jsp" enctype="multipart/form-data" target="myiframe">
<div style="margin:4px;"> 插入图片 </div>
<input type="file" name="file1" id="file1" style="width:235px; border:#7E9DB9 1px solid"><br />
<input type="submit" style="margin:4px;" value="确定">
<input type="reset" style="margin:4px;" onclick="calcelimg();" value="取消" >
</form>
</div>upload.jsp最后一句如下
<script>window.parent.insertimg('<%=largepic%>');</script>
应该是这句,不能把图片地址反回到index.html中的JS函数中去,请教高手如何修改。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货