火狐IE下获取完整文件路径名的方法
来源:互联网 发布:pps for mac官方下载 编辑:程序博客网 时间:2024/05/16 19:09
抄:
以下为引用的内容:
<input name="upfile1" type="file" id="upfile1" onchange="SeePicNew2('uploadfield1',this);" />
<div class="divpre" id='uploadfield1'></div>
function SeePicNew2(imgdid,f) {
if(f.value=='') return ;
var newPreview = document.getElementById(imgdid);
// 这段代码是关键,如果是FF,则f.fles为真
if (f.files) {
var filepath = f.files.item(0).getAsDataURL();
} else {
var filepath = 'file:///'+f.value.replace(////g,"/").replace(//:/,"|");
}
var image = new Image(); var ImgD = new Image();
ImgD.src = filepath;
image.src = ImgD.src; FitWidth = 150; FitHeight = 100;
if(image.width>0 && image.height>0)
{
if(image.width/image.height>= FitWidth/FitHeight)
{
if(image.width>FitWidth)
{
ImgD.width=FitWidth;
ImgD.height=(image.height*FitWidth)/image.width;
}
else
{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
else
{
if(image.height>FitHeight)
{
ImgD.height=FitHeight;
ImgD.width=(image.width*FitHeight)/image.height;
}
else
{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
newPreview.style.width = ImgD.width+"px";
newPreview.style.height = ImgD.height+"px";
if(window.navigator.userAgent.indexOf("MSIE") < 1)
{
newPreview.style.background = "url('"+ImgD.src+"') no-repeat";
}
else
{
newPreview.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ImgD.src+"',sizingMethod='scale')";
}
ImgD = image = null;
//newPreview.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = f.value;
}
- 火狐IE下获取完整文件路径名的方法
- ie火狐获取file的路径
- mac下获取文件的完整路径
- MFC获取鼠标拖入文件的完整路径名
- linux获取文件的路径名及其文件名的方法
- 关于火狐(firefox)及ie下event获取的两种方法
- 关于火狐(firefox)及ie下event获取的两种方法
- 关于火狐(firefox)及ie下event获取的两种方法
- 兼容ie 谷歌 火狐的获取焦点失去焦点方法
- 火狐下获取选中的checkbox方法
- 火狐下获取自定义属性的方法
- GetWindowsDirectory(获取windows目录的完整路径名)
- Delphi获取完整文件路径的各部分
- 获取IE的实际文件路径
- Linux下获取进程完整路径(包括进程名)——完整实例代码实现
- C/C++获取相对当前启动路径(.exe)下的文件全路径名
- 获取指定路径下的文件夹名
- 生成完整路径名的两种方法
- InfoObject Exception Aggregation
- 软件测试学习笔记一
- 广东 迎难而上打“硬仗”-加快经济增长方式调研行(一)
- 干部“公选”,每个环节都决定成败(时事观察)
- IP Camera 开发平台之Profilic公司的PL-1129介绍
- 火狐IE下获取完整文件路径名的方法
- 求大阶乘的位数
- Window下GTK开发环境搭建/Code::Blocks开发环境搭建/GLib程序测试
- 在Visual C++中用ADO进行数据库编程
- UVa 10003 Cutting Sticks
- VC中ADO编程
- Go语言学习札记——第一章 Go语言概述
- 插入排序
- Socket基础