Write One,Run Everywhere
-------我只想用24个字母、9个数字、下划线_和美圆$编织我心中的图象!
登录
注册
全站
当前博客
空间
博客
好友
相册
论坛
留言
用户操作
[即时聊天]
[发私信]
[加为好友]
雪地白狐
ID:ivorytower
共
27644
次访问,排名
4438
,好友
29
人,关注者
57
人。
毕业于电子科技大学
所学专业为计算机科学与技术---软件工程
从事嵌入式开发
ivorytower的文章
原创 48 篇
翻译 0 篇
转载 55 篇
评论 14 篇
雪地白狐的公告
在这里,只存在着技术及思想,只供我个人的学习与参考,喜欢自己的文章,更喜欢有独到见解的他人文章。 _______________________________ 路径隐香处,翩然雪海间。________梅花仍尤在,雪海何处寻。
最近评论
sunnyboycao:
写得不错,对我这样的人有帮助
taylergreen:
请问哪里有电子版的书下载
ashley_zfy:
很简单,谢啦!
ashley_zfy:
很简单,谢啦!
denzisui:
我的tomcat6不知怎么的突然有一天无法启动。我只好在网上重新下了tomcat6,按照你说的把环境配置好,多谢你了!
文章分类
C#技术文章
(RSS)
C/C++技术文章
(RSS)
HASH专题
(RSS)
JAVA技术文章
(RSS)
LAMP技术研究
(RSS)
SSH技术及Web应用
(RSS)
Unix/Linux 专题
(RSS)
对象池技术专题
(RSS)
软件测试
(RSS)
软件工程--开发团队与系统架构
(RSS)
设计模式专题
(RSS)
数据库技术
(RSS)
数字电视研究
(RSS)
通讯簿系统开发
(RSS)
收藏
相册
C/C++类友情博客
梦在天涯
谭振林的博客
JAVA类友情博客
HuDon的专栏
精彩技术网页
3P代码
IBM——WebSphere和SOA
中国IT实验室
其他友情技术博客
dflying的博客
Drate的随笔
feng_sundy的专栏
Martin Fowler中文博客
vinep的专栏
蒋清野
存档
2008年09月(2)
2008年05月(10)
2008年04月(32)
2008年03月(2)
2007年12月(3)
2007年10月(11)
2007年09月(6)
2007年08月(3)
2007年04月(3)
2007年01月(27)
2006年12月(5)
订阅我的博客
批量上传不同图片
收藏
新一篇: 佳得视数字电视机顶盒共享器原理分析
|
旧一篇: PHP生成HTML的思路------高级篇
<%
...
@ Page Language
=
"
C#
"
AutoEventWireup
=
"
true
"
CodeFile
=
"
163上传控件.aspx.cs
"
Inherits
=
"
mytest_163上传控件
"
Debug
=
"
true
"
%>
<!
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
>
163上传
</
title
>
<
style
type
="text/css"
>
...
a.addfile
{...}
{
background-image
:
url(http://p.mail.163.com/js31style/lib/0703131650/163blue/f1.gif)
;
background-repeat
:
no-repeat
;
background-position
:
-915px -17px
;
display
:
block
;
float
:
left
;
height
:
20px
;
margin-top
:
-1px
;
position
:
relative
;
text-decoration
:
none
;
top
:
0pt
;
width
:
80px
;
}
input.addfile
{...}
{
cursor
:
pointer !important
;
height
:
18px
;
left
:
-13px
;
filter
:
alpha(opacity=0)
;
position
:
absolute
;
top
:
5px
;
width
:
1px
;
z-index
:
-1
;
}
img.addfile
{...}
{
background-image
:
url(http://p.mail.163.com/js31style/lib/0703131650/163blue/f1.gif)
;
background-repeat
:
no-repeat
;
background-position
:
-802px -36px
;
width
:
13px
;
height
:
13px
;
}
</
style
>
<
script
type
="text/javascript"
>
...
window.$
=
document.getElementById;
var
fileNumber
=
0
;
function
createnew()
...
{
if
( IsExist(
this
.value))
...
{
var
father
=
this
.parentNode;
while
(father.firstChild)
...
{
father.removeChild(father.firstChild);
}
var
newf
=
document.createElement(
"
input
"
);
newf.type
=
this
.type;
newf.name
=
this
.name;
newf.className
=
this
.className;
newf.runat
=
this
.runat;
newf.onchange
=
this
.onchange;
father.appendChild(newf);
alert(
"
请不要上传相同图片!
"
);
return
;
}
var
c_a
=
$(
'
container1
'
);
//
找到上传控件的a容器
var
c_div
=
$(
'
container2
'
);
//
放置图片的容器
var
fileCtr
=
c_a.firstChild;
//
上传控件
var
subDiv
=
document.createElement(
"
div
"
);
//
将放置到c_div中的容器
var
img1
=
document.createElement(
"
img
"
);
//
上传的图片
img1.src
=
"
file://
"
+
fileCtr.value;
img1.style.width
=
"
30px
"
;
img1.style.height
=
"
30px
"
;
img1.onerror
=
function
()
...
{
alert(
"
请上传图片!
"
);
var
father
=
this
.parentNode;
var
gfather
=
father.parentNode;
father.removeChild(
this
);
gfather.removeChild(father);
}
var
img2
=
document.createElement(
"
img
"
);
//
删除图片按钮
img2.className
=
"
addfile
"
;
img2.onclick
=
function
()
...
{
this
.parentNode.parentNode.removeChild(
this
.parentNode)}
subDiv.appendChild(img1);
subDiv.appendChild(img2);
subDiv.appendChild(fileCtr);
c_div.appendChild(subDiv);
fileNumber
++
;
var
newFileCtr
=
document.createElement(
"
input
"
);
newFileCtr.type
=
"
file
"
;
newFileCtr.className
=
"
addfile
"
;
newFileCtr.runat
=
"
server
"
;
newFileCtr.name
=
"
file_
"
+
fileNumber;
newFileCtr.onchange
=
createnew;
while
(c_a.firstChild)
...
{
c_a.removeChild(c_a.firstChild);
}
c_a.appendChild(newFileCtr);
}
//
相同文件控制
function
IsExist(name1)
...
{
var
upfiles
=
document.getElementsByTagName(
"
input
"
);
var
n
=
0
;
for
(
var
i
=
0
; i
<
upfiles.length;i
++
)
...
{
var
file
=
upfiles[i];
if
( file.type
==
"
file
"
&&
file.value
==
name1)
...
{
n
++
;
}
if
( n
>
1
)
//
找到两个
...
{
return
true
;
}
}
return
false
;
}
</
script
>
</
head
>
<
body
>
<
form
id
="form1"
runat
="server"
>
<
div
>
<
a
id
="container1"
class
="addfile"
>
<
input
name
="file_0"
type
="file"
class
="addfile"
onchange
="createnew();"
runat
="server"
/>
</
a
>
</
div
>
<
div
id
="container2"
style
="position:relative; float:left; "
>
</
div
>
<
asp:Button
ID
="Button1"
runat
="server"
Text
="Button"
OnClick
="Button1_Click"
/>
</
form
>
</
body
>
</
html
>
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
public
partial
class
mytest_163上传控件 : System.Web.UI.Page
...
{
protected
void
Page_Load(
object
sender, EventArgs e)
...
{
}
protected
void
Button1_Click(
object
sender, EventArgs e)
...
{
string
s
=
"
上传图片有:
"
;
for
(
int
i
=
0
;i
<
Request.Files.Count;i
++
)
...
{
s
+=
Request.Files[i].FileName
+
"
"
;
}
Response.Write(s);
}
}
发表于 @
2008年05月21日 21:06:02
|
评论(
loading...
)
|
编辑
新一篇: 佳得视数字电视机顶盒共享器原理分析
|
旧一篇: PHP生成HTML的思路------高级篇
评论:没有评论。
发表评论
姓 名:
主 页:
校验码:
看不清,换一张
登录