本来不想发贴的,但找来找去都没有找到好的解决方案~~~问题如题~~<image id='po' src=""/> <input type="File" name="picturename" onpropertychange="po.src= this.value"><br> 这一段代码在纯html下可以完美解决我的问题,但放在asp.net里就不行了。然而,在asp.net生成的源文件另存为的html里,又可以了~~~~请问还有没有别的更好的解决方案呢???
解决方案 »
- 已经把excel文件上传到服务器,怎么将excel中的数据导入到SQL数据库呢?用asp.net和c#
- visual studio2008(c#)怎么连接access?
- vs;c#;web开发;注释;/// <summary>
- C#怎么定义一个变量,占内存10个字节
- 如何解决Visual Studio高版本无法打开低版本
- 在vb.net新建项目里选择ASP。NET WEB应用程序就出错,是怎么会事?
- 关于&#开头的HTML实体编码的问题
- 各位朋友哪有dotnet和msdn中文版的下载(最新版),谢谢
- 关于页面刷新的问题。在线等。急!
- 在HTML代码中插入C#代码的问题
- 看了两天的问题,没有解决!
- 关于updatepanel的问题
现在的浏览器都已经有限制了,可以设置不允许在上传的时候将文件目录也传递了,只能得到文件名,Firefox默认现在已经是这样了,ie7也可以设置不能带文件路径了,所以,这种方法可能不再可以使用
我也是这样觉得,但是看dicuz!的.net版还是可以的,现在在看他的源码,希望能看到点什么出来。
function display(abc) {
alert(abc.value);
document.getElementById("img").src = abc.value;
var id1 = document.getElementById("id1");
id1.style.background ="url("+ abc.value +")";
}
</script>
</head>
<body>
<asp:Image ID="img" runat="server" />
<div id="id1" style="width:100px; height:100px; background:red;"></div>
<input type="file" id="file" onchange="display(this)" />
比如:xx%123xx.gif,这样的名字预览不了!firefox 只能预览图片名了!
<script type="text/javascript" language="javascript">
function display(abc) {
alert(abc.value);
var id1 = document.getElementById("id1");
// id1.style.background = "url(" + abc.value + ")";
id1.innerHTML = '<div style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=\'scale\',src=\'' + abc.value + '\'); width:120px; height:100px; border="0" id="zbc" aid="dd" alt="" />';
// id1.innerHTML='<img src='+abc.value+' />'
}
</script>
</head>
<body><div id="id1" style="width:100px; height:100px; "></div>
<input type="file" id="file" onchange="display(this)" />
但是这个方法并不完美,在FF Opera等非IE浏览器下一点效果都没 - - !
看来浏览器革命也害死不少人~~~
这个方法,找了不少时间,也希望能有多点人看得到~~依然谢谢各位大大
试试下面的代码:
<script language="javascript" type="text/javascript">
function ShowImage(obj)
{
var file=obj.value;
var img=document.getElementById("ctl00_cphContent_DetailsView1_imgMovilePic");
img.visible=true;
img.src=file;
}
</script>
下面是调用:
<asp:FileUpload ID="FileUploadPic" runat="server" onchange="ShowImage(this)" />
这样应该不行吧?????我开贴就是针对这样不行才开的,主要原因是IE7不支持,我估计你用的一定是IE6。不过还是谢谢你。
建议楼主再自己试验下~~~
<script language="javascript" type="text/javascript">
function ShowImage(obj)
{
var file=obj.value;
var img=document.getElementById("ctl00_cphContent_DetailsView1_imgMovilePic");
img.visible=true;
img.src=file;
}
</script>
下面是调用:
<asp:FileUpload ID="FileUploadPic" runat="server" onchange="ShowIma…
这样貌似确实不行啊~~~~书友会http://www.shuyouhui.net