想给input file 添加个事件
添加了个 <INPUT type= "file " id= "upfile " name= "upfile " 〉
想给upfile添加个事件,事件怎么添加?
还有想在这个事件里实现 选择图片的时候立刻在 本页中的一个图层里显示!
请教各位高手,我还没上路!^^
------解决方案--------------------string fullfilename = this.FileUpload1.PostedFile.FileName;
string filename=fullfilename .Substring (fullfilename .LastIndexOf ( "\\ ")+1);
string type=fullfilename .Substring (fullfilename .LastIndexOf ( ". ")+1);
if (type == "jpg "||type== "bmp "||type== "gif ")
{
this.Image1.ImageUrl =filename ;
}
我这好象有点小问题,不过大概是这样了,在等高人,我也刚学这个
------解决方案-------------------- <script>
function initImg()
{
document.all.img1.src = document.all.File2.value; //img1为 <img id= "img1 ">
}
</script>
<INPUT id= "File2 " type= "file " name= "File1 " onchange= "initImg(); ">