对file框赋值是不允许的,除非用控件,但会出现提示:
请参照下面:在你的photo1在加onchange,然后对路径处理赋给你它file
<script language=javascript>
function window.onload()
{
meizz.focus();
var WshShell=new ActiveXObject("WScript.Shell"); //会有安全提示
WshShell.sendKeys("c:\\test.txt"); //向文本框里发送东东
}
</script>
<input name=photo2 type=file>
请参照下面:在你的photo1在加onchange,然后对路径处理赋给你它file
<script language=javascript>
function window.onload()
{
meizz.focus();
var WshShell=new ActiveXObject("WScript.Shell"); //会有安全提示
WshShell.sendKeys("c:\\test.txt"); //向文本框里发送东东
}
</script>
<input name=photo2 type=file>
解决方案 »
- 如何捕获容器外的点击,来操作容器变化?
- 没人会吗?jquery学习:求标签中没有另一标签的获取方法
- 如何确定当前播放内容(currentMedia)在Windows Media Player控件播放列表(currentPlaylist)中的位置(index)?
- firefox怎么得到 ondrag="return false"
- 这种效果是水印技术吗?,做的具体思路是什么?求指导
- 如何在文本框中禁止输入法切换到全角模式
- 在一个iframe里如何调用另一个iframe里的js function ???????????
- 各位大侠:怎样将日文字符转换成unicode编码?
- less生成css问题
- 求助js Canvas 问题
- JAVASCRIPT中如何使用SESSION(“USERID”)的?
- 加快客户端的显示
function window.onload()
{
photo.focus();
var WshShell=new ActiveXObject("WScript.Shell"); //会有安全提示
WshShell.sendKeys("c:\\test.txt"); //向文本框里发送东东
}
</script>
<input name=photo type=file>
好像不行呢!//这是那个函数
function setOtherFile()
{
var filePath;
filePath = document.frm.photo1.value;
photo2.focus();
var WshShell=new ActiveXObject("WScript.Shell"); //会有安全提示
WshShell.sendKeys(filePath); //向文本框里发送东东
}//这是我的其中的两个<input><tr bgcolor="#FFFFFF" height="35" >
<td ><input type="file" name="photo1" size=65 onchange="setOtherFile
()" /> (20*20)</td>
</tr>
<tr bgcolor="#FFFFFF" height="35">
<td ><input type="file" name="photo2" size=65 /> (20*24)</td>
</tr>
请问是上面我的是对的吗?如果是对的,那么不行呢,
呜还请各位高手帮忙啊!!!!
function test(str)
{
var preValue = str;
var arrValue = preValue.split(".");
document.all.inputFile1.value = arrValue[0].substring(0,arrValue[0].length-2) + "1." + arrValue[1];
document.all.inputFile2.value = arrValue[0].substring(0,arrValue[0].length-2) + "2." + arrValue[1];
document.all.inputFile3.value = arrValue[0].substring(0,arrValue[0].length-2) + "3." + arrValue[1];
document.all.inputFile4.value = arrValue[0].substring(0,arrValue[0].length-2) + "4." + arrValue[1];
}
</SCRIPT>
<BODY>
<input type=file id=fileId0 style="display: none" onPropertyChange="inputFile0.value=value">
<input name=inputFile0 onPropertyChange="test(this.value)"><input type=button value=' 浏 览 ' src="" onclick="fileId0.click()"><br><br><input type=file id=fileId1 style="display: none" onPropertyChange="inputFile1.value=value">
<input name=inputFile1><input type=button value=' 浏 览 ' src="" onclick="fileId1.click()"><br><br><input type=file id=fileId2 style="display: none" onPropertyChange="inputFile2.value=value">
<input name=inputFile2><input type=button value=' 浏 览 ' src="" onclick="fileId2.click()"><br><br><input type=file id=fileId3 style="display: none" onPropertyChange="inputFile3.value=value">
<input name=inputFile3><input type=button value=' 浏 览 ' src="" onclick="fileId3.click()"><br><br>
<input type=file id=fileId4 style="display: none" onPropertyChange="inputFile4.value=value">
<input name=inputFile4><input type=button value=' 浏 览 ' src="" onclick="fileId4.click()"><br><br>
</BODY>