简单的问题!!求助!!

baiyong101 2005-03-17 04:25:28
点一个按钮,id=command,name =command
打开一个打开文件的对话框,
选定要的文件(文本文件)以后,如:c:\program\good.txt
good.txt 内容:
<html>
<head>
</head>
<body>
<p>这是我的文档</p>
</body>
</html>

在一个textarea name=text中显示出来;
并且把指定的字符串str="good bye"
插入到</body>之前,
拜托!!


...全文
85 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
kendo7 2005-03-17
  • 打赏
  • 举报
回复
这样?
<form name=form1>
<input type=file name=myfile>
<input type=button value="显 示" onclick=show()>
<textarea name="content" cols="30" rows="5" ></textarea>
</form>
<script language=javascript>
function show(){
var forreading=1;
var fso,f;
var filename;
filename=document.all.form1.myfile.value;
fso=new ActiveXObject("Scripting.FileSystemObject");
f=fso.OpenTextFile(filename,forreading);
var content;
content=f.ReadAll();
document.all.form1.content.innerText=content;
f.close();
}
</script>
baiyong101 2005-03-17
  • 打赏
  • 举报
回复
其实很简单的,
可能是我说的复杂了,
其实分两部分:
1。打开一个文件在textarea中显示,
2。就是在textarea中的某个位置</body>插入一个字符串str="good bye"
插入字符串写成一个函数!!!
我在线等待!!
wfwclyms 2005-03-17
  • 打赏
  • 举报
回复
不太明白楼主的意思
myvicy 2005-03-17
  • 打赏
  • 举报
回复
楼上正解。
hbhbhbhbhb1021 2005-03-17
  • 打赏
  • 举报
回复
dim regEx,Matches
dim str1
str1="<html><head></head><body><p>这是我的文档</p></body></html>"
set regEx=new regExp
regEx.Pattern= "(.+?)</body>(.+?)"
regEx.IgnoreCase=true
regEx.Global=True
Matches=regEx.Replace(str1,"$1Good bye$2")
set regEx=nothing
主要是怎么从那里读出来我不知道,以上是再</body>前插入那句话

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧