标题:我上传的文件怎么才能保存在编辑器里就和这个论坛一样
只看楼主
d778
Rank: 1
等 级:新手上路
帖 子:257
专家分:0
注 册:2006-1-10
 问题点数:0 回复次数:4 
我上传的文件怎么才能保存在编辑器里就和这个论坛一样
这个是我上传的代码!传后 文件自动就跑到<input name="fname" is fname type="text" size="48" class=formfont>这个里面了!但是如何上传完就让他自己跑到编辑器里呢?
就和这个论坛 一样 我点上面的上传 成功后 就自己跑里面来了


<iframe name=yasurup frameborder=0 width=400 height=23 scrolling=no src=upfile.htm></iframe>
<br>
<img src="img/tips.gif" width="16" height="16">只允许上传word excel txt zip rar格式的文件,上传后请不要更改下面地址。件最大允许为500K,请在提交前先上传资料文件,如果您的资料文件超过500K,建议您分拆成几个文件,按多个资料上传。</td>
</tr>
<tr>
<td width="22%" valign="top" nowrap class="f14">外部文件链接地址:</td>
<td width="78%" valign="top" class="f14"><input name="fname" is fname type="text" size="48" class=formfont>
<div><img src="img/tips.gif" width="16" height="16">以http://开头
,以.doc .xls .txt .zip .rar结尾。</div></td>
搜索更多相关主题的帖子: 编辑器 文件 name 
2007-05-18 09:53
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
得分:0 
正常在主窗口做一个javascript带参数的function来实现把参数写入表单
被iframe的页面执行上传后调用父窗口function
2007-05-18 10:15
d778
Rank: 1
等 级:新手上路
帖 子:257
专家分:0
注 册:2006-1-10
得分:0 

我还是不明白!
怎么弄?
我程序代码

<!--#include file=conn.asp-->
<!--#include file="config.asp"-->

<link href="css/Css0.Css" rel="stylesheet" type="text/css">

<script language = "JavaScript" src="css/d8b.js"></script>
<%if session("person")="" then
response.write"<script>alert('对不起,您未登录!');window.navigate('login.asp');</script>"
end if
dim count
rs3.open"select * from assort order by id asc",conn,1,1
%>
<SCRIPT language="JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs3.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs3("topic"))%>","<%= trim(rs3("shuxing"))%>","<%= trim(rs3("id"))%>");
<%
count = count + 1
rs3.movenext
loop
rs3.close
%>
onecount=<%=count%>;

function changelocation(locationid)
{
document.ftiwen.BoardClass.length = 0;

var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.ftiwen.BoardClass.options[document.ftiwen.BoardClass.length] = new Option(subcat[i][0], subcat[i][2]);
}
}

}
</SCRIPT>


<html>
<head>
<title><%=webname%>--提问任务</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="iknow.css" rel="stylesheet" type="text/css">




</head>
<body class="bgbdy" topmargin="0">
<center>

<script language=javascript>
function checkform(obj)
{
gcv();
if(obj.BoardNlass.value=="" || obj.BoardClass.value==0)
{
alert("请选择任务分类");return false;
}
if(obj.title.value =="" || obj.title.value.length ==0)
{
alert("请输入任务标题");obj.title.focus();return false;
}
var leftChars = getLeftChars(obj.title,50);

if ( leftChars < 0)
{
ls_str = "任务字数限定在50个汉字以内,请缩短提问字数";
alert(ls_str);
obj.title.focus();
return false;
}
if(leftChars>92)
{
ls_str = "任务标题不详细,请重新输入";
alert(ls_str);
obj.title.focus();
return false;
}
var content_length = obj.content.value.length;
if ( content_length >3000)
{
ls_str = "任务补充说明字数限定在3000字节以内,请缩短字数";
alert(ls_str);
obj.content.focus();
return false;
}
}
function getLeftChars(varField,limit_len) {
var i = 0;
var counter = 0;
var cap = limit_len*2;
var j=0;
var runtime = (varField.value.length>cap)?(cap+1):varField.value.length;
for (i = 0; i< runtime; i++) {
if (varField.value.charCodeAt(i) > 127 || varField.value.charCodeAt(i) == 94) {
j=j+2;
}
else {
j=j+1
}
} //结束FOR循环
//var leftchars = cap - varField.value.length;
var leftchars = cap - j;
return (leftchars);
}
function gcv()
{
var aa = document.getElementsByName("ra");
for (var i=0; i<aa.length; i++)
{
if(aa[i].checked)
document.ftiwen.cid.value = aa[i].value;
}
}
</script>
<!--#include file=top.asp-->
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25" nowrap><a href="<%=weburl%>"><%=webname%></a> &gt; 提问</td>
</tr>
</table>
<div id="cDiv">
<table border="0" align="right" cellpadding="0" cellspacing="0">
<tr><td width="220" valign="top" class="padL12">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td nowrap class="bgtle">相关任务</td>
</tr>
<tr><td class="bgcntLn"><table width="100%" border="0" cellspacing="0" cellpadding="0" class=zhtable>
<%
if HTMLcode(request("content"))<>"" then
content=HTMLcode(request("content"))
rs.open"select top 10 * from question where title like '%"&content&"%' or content like '%"&content&"%'",conn,1,1
if rs.eof then
else
while not rs.eof
i=i+1
%>
<tr><td width="25" align=center class="ln28pl4"><%=i%>.</td>
<td width="25" align=center class="ln28pl4"><%if rs("jie")=0 then %><img src=img/icn_time.gif alt=待解决任务><%elseif rs("jie")=1 or rs("jie")=3 then%><img src=img/icn_ok.gif alt =已解决任务><%elseif rs("jie")=2 then%><img src=img/icn_cancel.gif alt =任务已关闭><%elseif rs("jie")=4 then%><img src=img/icn_vote.gif alt =投票中任务><%end if%></td>
<td class="ln28pl4"><a href="showquestion.asp?id=<%=rs("id")%>" target=_blank><%=HTMLcode(rs("title"))%></a></td></tr>
<%
rs.movenext
wend
end if
rs.close
end if
%>
</table></td>
</tr></table>
</td> </tr></table>
<%if request("send")="提交任务" then
if session("person")="" then
response.write"<script>alert('用户超时,请重新登录!');history.back();</script>"
end if
if (request.form("nm")="1" ) then
nmfen=mdf
niming=1
else
nmfen=0
niming=0
end if
if request("shang")="" then
shang=0
else
shang=cINT(request("shang"))
end if
rs3.open"select * from person where name='"&session("person")&"'",conn,1,1
shang1=rs3("jifen")
rs3.close
if shang >= shang1 then
response.write"<script>alert('您的积分不够!');history.back();</script>"
response.end
end if
if request("BoardNlass")="" then
response.write"<script>alert('一级分类不能为空!');history.back();</script>"
response.end
elseif request("BoardClass")="" then
response.write"<script>alert('二级分类不能为空!');history.back();</script>"
response.end
elseif request("title")="" then
response.write"<script>alert('标题不能为空!');history.back();</script>"
response.end

elseif request("content")="" then
response.write"<script>alert('补充说明不能为空!');history.back();</script>"
response.end
if right(request("fname"),3)<>"rar" and right(request("fname"),3)<>"zip" and right(request("fname"),3)<>"txt" and right(request("fname"),3)<>"doc" and right(request("fname"),3)<>"xls" then
response.write"<script>alert('对不起,您发布的文件类型是不允许的!');history.back();</script>"
response.end
end if
rs3.open"select * from person where name='"&session("person")&"' and jie=3",conn,1,1
if not rs3.eof then
response.write"<script>alert('您还有过期任务没有处理,请处理后再发表新任务!');history.back();</script>"
response.end
end if
rs3.close
else
rs3.open"select * from assort where id="&request("BoardClass")&"",conn,1,1
topic=rs3("topic")
rs3.close
title=request("title")
content=request("content")
lei=right(request("fname"),3)
rs.open"select * from question",conn,1,3
rs.addnew
rs("topic")=topic
rs("title")=title
rs("content")=content
rs("sender")=session("person")
rs("sendtime")=now
rs("overtime")=now+15
rs("shuxing")=request("BoardNlass")
rs("fenleiid")=request("BoardClass")
rs("shang")=shang
rs("niming")=niming

rs("fname")=request("fname")
rs("ffname")=request("ffname")
rs("lei")=lei
rs("b")=request("zj")
rs.update
rs.close

rs3.open"select * from person where name='"&session("person")&"'",conn,1,3
rs3("asknum")=rs3("asknum")+1
rs3("qtfa")=rs3("qtfa")+twf+nmfen
rs3("jifen")=rs3("jifen")-twf-shang-nmfen
if rs3("jifen")-twf-shang-nmfen<fen1 then
rs3("touxian")=""&ji1&" 一级"
elseif rs3("jifen")-twf-shang-nmfen>=fen1 and rs3("jifen")-twf-shang-nmfen<fen2 then
rs3("touxian")=""&ji1&" 一级"
elseif rs3("jifen")-twf-shang-nmfen>=fen2 and rs3("jifen")-twf-shang-nmfen<fen3 then
rs3("touxian")=""&ji2&" 二级"
elseif rs3("jifen")-twf-shang-nmfen>=fen3 and rs3("jifen")-twf-shang-nmfen<fen4 then
rs3("touxian")=""&ji3&" 三级"
elseif rs3("jifen")-twf-shang-nmfen>=fen4 and rs3("jifen")-twf-shang-nmfen<fen5 then
rs3("touxian")=""&ji4&" 四级"
elseif rs3("jifen")-twf-shang-nmfen>=fen5 and rs3("jifen")-twf-shang-nmfen<fen6 then
rs3("touxian")=""&ji5&" 五级"
elseif rs3("jifen")-twf-shang-nmfen>=fen6 and rs3("jifen")-twf-shang-nmfen<fen7 then
rs3("touxian")=""&ji6&" 六级"
elseif rs3("jifen")-twf-shang-nmfen>=fen7 and rs3("jifen")-twf-shang-nmfen<fen8 then
rs3("touxian")=""&ji7&" 七级"
elseif rs3("jifen")-twf-shang-nmfen>=fen8 and rs3("jifen")-twf-shang-nmfen<fen9 then
rs3("touxian")=""&ji8&" 八级"
elseif rs3("jifen")-twf-shang-nmfen>=fen9 and rs3("jifen")-twf-shang-nmfen<fen10 then
rs3("touxian")=""&ji9&" 九级"
elseif rs3("jifen")-twf-shang-nmfen>=fen10 then
rs3("touxian")=""&ji10&" 十级"
end if
rs3.update
rs3.close
response.write"<script>alert('发表任务成功!');window.navigate('index.asp');</script>"
end if
end if

%>
<table width="538" border="0" cellpadding="0" cellspacing="0">
<form name="ftiwen" method="post" action="send.asp" onSubmit="return checkform(this);">
<tr> <td nowrap class="bgtle">提问</td></tr>
<tr><td class="bgcntLn">
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr valign="top">
<td width="22%" class="f14" nowrap>您的提问:</td>
<td width="78%"> <input name="title" type="text" value="<%=HTMLcode(request("content"))%>" size="48" class=formfont>
<br>
您可以参考其他用户提问过的相关任务→</td>
</tr>
</table>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="zhtable" >
<tr valign="top">
<td nowrap class="f14">任务补充说明:
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<TR>
<TD class=INDEX_XMALL width="90%" height="25">
</TD>
<TD width="1%" height="25"></TD></TR>
<TR>
<TD class=INDEX_XMALL width="90%" height="25">
</TD>
<TD width="1%" height="25"></TD></TR>
</table>

<textarea name="content" class="fcorg" style="display:none"></textarea>
<iframe ID="eWebEditor" src="Editor/ewebeditor.htm?id=content&style=coolblue" frameborder="0" scrolling="no" width="500" HEIGHT="350"></iframe>



<br>
任务说明越详细,回答也会越准确!参见<a href="help.asp#n1" target="_blank">如何发布</a>。 </td>
</table>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr valign="top">
<td width="22%" nowrap class="f14" rowspan="2">任务分类:</td>
<td width="25%" class=f13>
<SELECT class=input1 style="WIDTH: 125px" name="BoardNlass" onChange="changelocation(document.ftiwen.BoardNlass.options[document.ftiwen.BoardNlass.selectedIndex].value)" size="8">
<%
rs3.open"select * from class",conn,1,1
if rs3.eof and rs3.bof then
response.write "..."
response.end
else
%>
<OPTION selected value>==请选择大类==</OPTION>
<%do while not rs3.eof%>
<OPTION value="<%=trim(rs3("id"))%>"><%=trim(rs3("topic"))%></OPTION>
<%
rs3.movenext
loop
end if
rs3.close
set rs3=nothing
%></SELECT>

</td>
<td width="4%" class=f13 valign="middle">
<div align="center">
<b>→</b>
</div>

</td>
<td width="49%" class=f13 colspan="2">
<SELECT name="BoardClass" size="8" style="WIDTH: 90px"><OPTION selected value>==请选择小类==</OPTION></SELECT>

</td>
</tr>
<tr>
<td width="25%" class=f14>
<font color="#ff0000">一级分类</font>
</td>
<td width="4%" class=f14>
</td>
<td width="17%" class=f14>
<font color="#ff0000">二级分类</font>
</td>
<td width="32%" class=f14>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="22%">&nbsp;</td>
<td><span class="f14"><img src="img/tips.gif" width="16" height="16"></span>请您选择正确的分类,以使您的任务尽快得到解答。</td>
</tr>
</table>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="22%" valign="top" nowrap class="f14">悬赏分:</td>
<td width="78%"><div style="height:28px;" class="f14">
<input name="shang" type="text" value="" size="10" class=formfont>

</select>您目前的积分:<%=jifen%> 。 </div><div><img src="img/tips.gif" width="16" height="16">悬赏分越高,您的任务会越受关注,从而得到更佳答案。</div></td>
</tr>
</table>
<br><table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="22%" valign="top" nowrap class="f14">选择文件:</td>
<td width="78%" valign="top" class="f14"><iframe name=yasurup frameborder=0 width=400 height=23 scrolling=no src=upfile.htm></iframe>
<br>
<img src="img/tips.gif" width="16" height="16">只允许上传word excel txt zip rar格式的文件,上传后请不要更改下面地址。件最大允许为500K,请在提交前先上传资料文件,如果您的资料文件超过500K,建议您分拆成几个文件,按多个资料上传。</td>
</tr>
<tr>
<td width="22%" valign="top" nowrap class="f14">外部文件链接地址:</td>
<td width="78%" valign="top" class="f14"><input name="fname" is fname type="text" size="48" class=formfont>
<div><img src="img/tips.gif" width="16" height="16">以http://开头
,以.doc .xls .txt .zip .rar结尾。</div></td>
</tr>
</table>
<br>
<input type="hidden" name="zj" value=""><input type="hidden" name="ffname" value=""><%if md=1 then%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="22%" valign="top" nowrap class="f14">匿名设定:</td>
<td width="78%" valign="top" class="f14"> <input type="checkbox" name="nm" value="1">
您可以对任务设定匿名,但您需要付出积分5分。</td>
</tr>
</table>
<br><%end if%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="22%" class="f14">&nbsp;</td>
<td width="78%" valign="top"><input type="submit" name="send" value="提交任务" class="bnsrh">

<input type=hidden name="cid" value=0>
</td>
</tr>
</table></td>
</tr></form>
</table>

</div>

<br>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0" style="clear:both;"> <tr> <td height="30" align=center><!--#include file=end.asp--></td>
</tr>
</table>
</center>
</body>
</html>

[此贴子已经被作者于2007-5-18 10:53:12编辑过]


2007-05-18 10:51
lq7350684
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:5089
专家分:98
注 册:2006-11-6
得分:0 
2007-05-18 11:36
xuecg
Rank: 1
等 级:新手上路
帖 子:65
专家分:0
注 册:2007-5-13
得分:0 
上传用嵌入的页面&lt;iframe&gt;,在上传的页面中使用javascript脚本parent.document.all.容器名,就可以将上传后得到的信息写入父窗口的相应容器中了
2007-05-19 18:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-140369-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.084187 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved