[code=HTML][/c<%@ Page Language="C#" AutoEventWireup="true" CodeFile="userupdown.aspx.cs" Inherits="user_userupdown" EnableViewState="true" %><%@ Register Src="../Controls/usermenu.ascx" TagName="usermenu" TagPrefix="uc3" %><%@ Register Src="../Controls/HeadControl.ascx" TagName="HeadControl" TagPrefix="uc1" %>
<%@ Register Src="../Controls/footer.ascx" TagName="footer" TagPrefix="uc2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>会员上传图片</title>
<link rel ="stylesheet" type="text/css" href="../App_Themes/top.css" />
<link rel ="stylesheet" type ="text/css" href ="../App_Themes/usermange.css" />
</head>
<body> <form id="form1" runat="server">
<script type ="text/javascript">
function preview()
{
var imag=document.getElementById("divimg");
imag.style.display="block";
var updown=document.getElementById("File1");
imag.src=updown.value;
}
</script>
<div>
<uc1:HeadControl ID="HeadControl1" runat="server" />
<div id="usermanger">
<div class ="left">
<uc3:usermenu ID="Usermenu1" runat="server" />
</div>
<div class ="content">
<div class="title">上传图片</div>
<br />
<div style="width:300px;text-align:left;float:left; clear:left;">
<asp:Label ID="exe" runat="server" Text="Label" Visible="False"></asp:Label><br />
<input id="File1" runat="server" name="file" type="file" style="width: 321px; height: 21px" onchange="preview();" /><br />
<img id="divimg" style="display :none; width:100px;height:100px;"alt ="预览" src="" /><br />
ode]
<%@ Register Src="../Controls/footer.ascx" TagName="footer" TagPrefix="uc2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>会员上传图片</title>
<link rel ="stylesheet" type="text/css" href="../App_Themes/top.css" />
<link rel ="stylesheet" type ="text/css" href ="../App_Themes/usermange.css" />
</head>
<body> <form id="form1" runat="server">
<script type ="text/javascript">
function preview()
{
var imag=document.getElementById("divimg");
imag.style.display="block";
var updown=document.getElementById("File1");
imag.src=updown.value;
}
</script>
<div>
<uc1:HeadControl ID="HeadControl1" runat="server" />
<div id="usermanger">
<div class ="left">
<uc3:usermenu ID="Usermenu1" runat="server" />
</div>
<div class ="content">
<div class="title">上传图片</div>
<br />
<div style="width:300px;text-align:left;float:left; clear:left;">
<asp:Label ID="exe" runat="server" Text="Label" Visible="False"></asp:Label><br />
<input id="File1" runat="server" name="file" type="file" style="width: 321px; height: 21px" onchange="preview();" /><br />
<img id="divimg" style="display :none; width:100px;height:100px;"alt ="预览" src="" /><br />
ode]
解决方案 »
- 只能输入最多4位数字(其中必须有小数点,小数点后面只能有一位数字,例子:333.3) ,正则表达式帮琢磨一下,谢谢了
- jQuery.param这个函数反向为对象有这个方法吗
- 求救 confirm 关闭事件问题
- Function.prototype原型链问题
- jquery的toggle事件浏览器不兼容的问题
- 使用jquery的UI时控件会变很大,大家有碰到过吗?
- 如何动态的往head标签中加入代码?
- 一段JS代码 IE能运行,FIREFOX不行,高手帮看下。。
- 怎么样能够,点击一个链接,打开本地电脑上的程序(例如QQ)
- post方法的ajax跨域
- script classpath问题
- 怎么用UrlReferrer 获取 (来源页) - 的上一页?Javascript!
另外预览本地文件涉及安全问题
现在发现在的:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="userupdown.aspx.cs" Inherits="user_userupdown" EnableViewState="true" %><%--<%@ Register Src="../Controls/usermenu.ascx" TagName="usermenu" TagPrefix="uc3" %><%@ Register Src="../Controls/HeadControl.ascx" TagName="HeadControl" TagPrefix="uc1" %>
<%@ Register Src="../Controls/footer.ascx" TagName="footer" TagPrefix="uc2" %>--%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>会员上传图片</title>
<link rel ="stylesheet" type="text/css" href="../App_Themes/top.css" />
<link rel ="stylesheet" type ="text/css" href ="../App_Themes/usermange.css" />
</head>
<body> <form id="form1" runat="server">
<script type ="text/javascript">
function preview()
{
var imag=document.getElementById("divimg");
imag.style.display="block";
var updown=document.getElementById("File1");
imag.src=updown.value;
}
</script>
<div>
<%-- <uc1:HeadControl ID="HeadControl1" runat="server" />--%>
<div id="usermanger">
<div class ="left">
<%-- <uc3:usermenu ID="Usermenu1" runat="server" />--%>
</div>
<div class ="content">
<div class="title">上传图片</div>
<br />
<div style="width:300px;text-align:left;float:left; clear:left;">
<asp:Label ID="exe" runat="server" Text="Label" Visible="False"></asp:Label><br />
<input id="File1" runat="server" name="file" type="file" style="width: 321px; height: 21px" onchange="preview();" /><br />
<img id="divimg" style="display :none; width:100px;height:100px;"alt ="预览" src="" /><br />
图片名字:<asp:TextBox ID="picture_name" runat="server" Width="127px"></asp:TextBox><br />
<br />
分 类:大类
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
</asp:DropDownList>
小类
<asp:DropDownList ID="DropDownList2" runat="server" Width="75px">
</asp:DropDownList><br /><br />
<div style="float:left;margin-top:5px;">是否允许评论: </div><asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal" Width="118px">
<asp:ListItem Value="1" Selected="True">是</asp:ListItem>
<asp:ListItem Value="0">否</asp:ListItem>
</asp:RadioButtonList>
<br />
关 键 字:<asp:TextBox ID="picture_keyword" runat="server" Width="218px"></asp:TextBox><br />
<br />
简 介:<asp:TextBox ID="picture_details" runat="server" TextMode="MultiLine" Height="90px" Width="320px" ></asp:TextBox><br />
<br />
来 自:<asp:TextBox ID="picture_source" runat="server" Width ="220px"></asp:TextBox><br/><br />
<br /><br />
</div><div style="color:Red;font-weight:bold;float:right;" >(请勿上传色情或违法反动图片)
<ol style="color:Black;font-weight:lighter;"><li>上传图片最大为1MB,图片过大请ps后再传</li>
<li>图片的最长为300px,超出部份将被截除</li>
<li>上传的新图片会很快在网站相应分类下显示</li>
<li>您的上传,表示您默认同意我们的内容协议</li></ol></div>
<p style="text-align:center; clear:both;">
<asp:Button ID="Button6" runat="server" Text="确定上传" /> <input id="Reset1" type="reset" value="取消上传" /></p></div></div>
<%--<uc2:footer ID="Footer1" runat="server" />--%>
</div>
</form>
</body>
</html>我是想在img标签里显示file 控件路径图片!可是不知道为什么不行??在html 页面里 js 就能实现??
function preview(obj)
{
var imag=document.getElementById("divimg");
imag.style.display="block";
imag.src=obj.value;
}
</script> <input id="File1" name="file" type="file" style="width: 321px; height: 21px" onchange="preview(this);" /> <br />
<img id="divimg" style="display :none; width:100px;height:100px;"alt ="预览" src="" /> <br />
其实file只是为只读而已,这样不需要考虑安全性,只有我们给file value时才会出错.
lz
代码测试过没有问题的呢.
为什么在ie 里面布局好好的 在火狐里面 却连竖直滑条都消失了
这样两者的布局基本就不会有差别