我有JavaScript代码,其中复制输入文件的值,并在文本框中实时过去。为什么JavaScript IF只能使用一次?
<script>
function copyit(){
var thephoto=document.getElementById('thephoto').value;
var fileonchange=document.getElementById('fileonchange').value;
if(!thephoto==fileonchange){
document.getElementById('fileonchange').value=thephoto;
}
}
window.setInterval("copyit()", 500);
</script>
Choose File : <input type="file" id="thephoto"><br>
Here Is the file name : <input type="text" id="fileonchange">
不幸的是,这只能用一次,然后再次更改文件时停止粘贴值。 (我的意思是你应该重新加载页面再次运作)
是IF
有一个缓存或什么?你可以自己试试看代码。
谢谢大家
谢谢你这么多BalusC,你知道,女孩吮吸代码XD – Emily 2010-04-08 18:39:10
亲爱的,那不是与性别:)只要有好书/教程,动机和心态。快乐的编码。 – BalusC 2010-04-08 18:55:42