如何对一个“file”赋值呢?

xjbx
博客专家认证
2003-07-10 05:44:58
有这样一个“file”:
<INPUT ID="idFile" TYPE="file" NAME="file1">

如何不单击这个“file”,而是直接给他赋值!我用"execCommand("plaster ")"方法没实现?

请高手指点!谢谢!
...全文
215 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
pantech_36 2003-07-15
  • 打赏
  • 举报
回复
没有办法的,我以前也找过。
还有一种调用组件的方法,但是也只是能显示,真的传文件没用。。。。。。。
xjbx 2003-07-15
  • 打赏
  • 举报
回复
看来只能动态去生成"file"了!
flyycyu 2003-07-14
  • 打赏
  • 举报
回复
可以自己做applet和servlet通讯
summercat 2003-07-14
  • 打赏
  • 举报
回复
不可以..
fason 2003-07-14
  • 打赏
  • 举报
回复
没有什么意义,它的value是只读的
fason 2003-07-14
  • 打赏
  • 举报
回复
没有什么意义,它的value是只读的
wangxiaomax 2003-07-14
  • 打赏
  • 举报
回复
给你一段以前做过的代码。希望对你有所帮助。
PhotoEdit.asp

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>图片编辑存储</title>
</head>
<script language="JavaScript" type="text/JavaScript">
var limit="0:02";
if (document.images){
var parselimit=limit.split(":");
parselimit=parselimit[0]*60+parselimit[1]*1;
}

function window.onload(){
resizeTo(400,150);
formPhotoEdit.newfile.focus();
var WshShell=new ActiveXObject("WScript.Shell");
WshShell.sendKeys("c:\\temp\\test.jpg"); //向文本框里发送东东
beginrefresh();
}

function beginrefresh(){
if (!document.images)
return;
if (parselimit==1){
formPhotoEdit.submit();
}else{
parselimit-=1;
setTimeout("beginrefresh()",1000);
}
}
</script>

<body bgcolor="#F8FBFC">
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:100%; height:100%; z-index:10; visibility: visible; background-color: #F8FBFC; layer-background-color: #F8FBFC; border: 1px none #000000;">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">正在保存图片...</td>
</tr>
</table>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<form name="formPhotoEdit" method="post" action=DBSavePhoto.asp enctype="multipart/form-data">
<input type="file" id="newfile" name="newfile" style="display:yes">
</form>
</td>
</tr>
</table>
</body>
</html>
sportdog 2003-07-14
  • 打赏
  • 举报
回复
不能直接给他赋值
zhanghk 2003-07-10
  • 打赏
  • 举报
回复
input file是只读的
webdj 2003-07-10
  • 打赏
  • 举报
回复
不行,安全性不允许!
jsidiot 2003-07-10
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=734

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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