在网页上java实现图片上传预览“预览图”怎么完成?

如何在网页上实现“预览图_百度知道
如何在网页上实现“预览图
提问者采纳
height=&预览图& lowsrc=&quot,就是将预览图做成一个链接;y&〉(其中 width 和 height 是需要显示的图片的宽度和高度。)
实现“预览图”还有一个方法,格式是。如果不加 width 和 height 属性,可以点击它; width=&quot,如果用户愿意:〈img src=&quot在 Html 文档中标注“low source”的方法为,再观看真正的图片;x&quot,浏览器视为以较小图片作为长宽尺寸;需要显示的图片&quot
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁使用swfupload实现网站图片上传,水印,预览和截图 - 网页制作技巧 - 编程入门网
使用swfupload实现网站图片上传,水印,预览和截图
周末闲着没事,将网站中经常用到的对图片的操作做了一个总结,方便以后回顾,这里将一天的成果,贴出来,希望能帮到大家。
首先是swfupload方式的无刷新上传,关于怎么配置,按照demo 的写法,我相信只要你不是太笨,都能成功。
关于swfupload你可以去网上下,也可以点这里下载:
项目结构:
上传代码:
前台上传页面,你可以根据需要建html页,也可以建webform。这里用一般处理程序来对照片进行处理,加水印,修改文件名等操作。
&%@ Page Language=&C#& AutoEventWireup=&true& CodeBehind=&SWFUploadImage.aspx.cs& Inherits=&Wolfy.ImageWeb.SWFUploadImage& %&
&!DOCTYPE html&
&html xmlns=&http://www.w3.org/1999/xhtml&&
&head id=&Head1& runat=&server&&
&title&&/title&
&meta http-equiv=&X-UA-Compatible& content=&IE=EmulateIE7&
&script src=&../SWFUpload/swfupload.js& type=&text/javascript&&&/script&
&script src=&../SWFUpload/handlers.js& type=&text/javascript&&&/script&
&script src=&../Script/jquery-1.7.1.js&&&/script&
&script type=&text/javascript&&
window.onload = function () {
swfu = new SWFUpload({
// Backend Settings
upload_url: &/SWFUploadHandler.ashx&,//交给一般处理程序来处理
post_params: {
&ASPSESSID&: &&%=Session.SessionID %&&
// File Upload Settings
file_size_limit: &2 MB&,
file_types: &*.*.gif&,
file_types_description: &JPG Images&,
file_upload_limit: 0,
// Zero means unlimited
// Event Handler Settings - these functions as defined in Handlers.js
The handlers are not part of SWFUpload but are part of my website and control how
my website reacts to the SWFUpload events.
swfupload_preload_handler: preLoad,
swfupload_load_failed_handler: loadFailed,
file_queue_error_handler: fileQueueError,
file_dialog_complete_handler: fileDialogComplete,
upload_progress_handler: uploadProgress,
upload_error_handler: uploadError,
upload_success_handler: Show,//这里修改了方法的定义。
upload_complete_handler: uploadComplete,
// Button settings
button_image_url: &/SWFUpload/images/XPButtonNoText_160x22.png&,
button_placeholder_id: &spanButtonPlaceholder&,
button_width: 160,
button_height: 22,
button_text: '&span class=&button&&选择上传图片 &span class=&buttonSmall&&(2 MB Max)&/span&&/span&',
button_text_style: '.button { font-family: Helvetica, Arial, sans- font-size: 14 } .buttonSmall { font-size: 10 }',
button_text_top_padding: 1,
button_text_left_padding: 5,
// Flash Settings
flash_url: &/SWFUpload/swfupload.swf&, // Relative to this file
flash9_url: &/SWFUpload/swfupload_FP9.swf&, // Relative to this file
custom_settings: {
upload_target: &divFileProgressContainer&
// Debug Settings
debug: false
//上传成功以后执行该方法
function Show(file, serverData) {
var s = serverData.split(':');//接收从服务端返回的数据,按照分号分隔
if (s[0] == &ok&) {
$(&#imgSrc&).attr(&src&, s[1]);
&form id=&form1& runat=&server&&
&div id=&content&&
&div id=&swfu_container& style=&margin: 0px 10&&
&span id=&spanButtonPlaceholder&&&/span&
&div id=&divFileProgressContainer& style=&height: 75&&&/div&
&img id=&imgSrc&如何实现一个全年日历12个月缩略图在整个页面显示???内附图片。。。。。。。。。【标题要长】-Java/Web开发-java-电脑编程网如何实现一个全年日历12个月缩略图在整个页面显示???内附图片。。。。。。。。。【标题要长】-Java/Web开发作者:ymdcr 和相关&&每个日期可以点击,日历与星期要对应上。哪位有思路或实现方法,麻烦提供一下,感激不尽。------回答---------------其他回答(1分)---------没必要自己写啊 这样的日历控件多的是哦。。------其他回答(1分)---------这样的日历控件多的是,何必自己实现呢?如果只是练习的话可以考虑------其他回答(10分)---------给你推荐一款JS插件/docs/products/dhtmlxScheduler/index.shtml?pl1------其他回答(2分)---------是啊,使用直接的日历控件即可。我记得当年我做的一个OA的时候,我就是用了一个日历控件,具体名字忘记了。楼主可以搜下。但是楼主要考虑浏览器的兼容问题。------其他回答(5分)---------引用 6 楼 ymdcr 的回复:那个dhx貌似可以试试不知老兄有没有中文说明文档这个很简单的啊你去看看官方提供的Sample,例子里面写的很详细/docs/products/dhtmlxScheduler/sample_basic.html
基本就是html和JS看看源代码,理解起来应该不难你也可以将插件下载下来,JS源码里面的注释也写的很详细的------其他回答(2分)---------有很多很好的实用的日期选择器控件------其他回答(5分)---------en
这个地址就是楼主要的/docs/products/dhtmlxScheduler/sample_basic.html------其他回答(1分)---------引用 10 楼 tangyu477 的回复:en 这个地址就是楼主要的/docs/products/dhtmlxScheduler/sample_basic.html要选一下 右上角的 YEAR------其他回答(5分)---------JScript code
......
scheduler.setLoadMode(&year&);
......
可直接切换到年视图------其他回答(1分)---------上网搜一下吧!网上很多------其他回答(1分)---------是呀这个自已写太累了,网上有好多现成的------其他回答(1分)---------红的那个是什么意思?------其他回答(25分)---------
Java code
&!DOCTYPE HTML PUBLIC &-//W3C//DTD HTML 4.0 Transitional//EN&&
&html&
&head&
&meta http-equiv=&Content-Type& content=&text/ charset=utf-8& /&
&title&无标题文档&/title&
&style type=&text/css&&
html,body{ font-size:12 font-family:&Courier New&, Courier, margin:0 padding:0}
#calendar{margin:50width:150font-size:12}
#calendar table{ border-collapse:}
#calendar table td{ height:20 width:20 border:1px solid #ff6600; text-align:}
#calendar .calendarTitle table .threetd{ width:62}
#calendar .calendarTitle table .twotd{ width:41}
#calendar .calendarTitle table td{ border-bottom:0}
.classOver{ background:#000000; color:#FFFFFF;}
.yearContainer{background:#border:1px solid #ff6600;position:width:62}
.yearContainer ul{list-style:margin:0padding:0}
.yearContainer ul li{height:18line-height:18display:text-align:}
.monthContainer{background:#border:1px solid #ff6600;position:width:41}
.monthContainer ul{list-style:margin:0padding:0}
.monthContainer ul li{height:18line-height:18display:text-align:}
a{ text-decoration: color:#990000;}
&/style&
&/head&
&body&
&script type=&text/script&&
var titleTable=&&div id=\&calendar\&&&div class=\&calendarTitle\&&&;
titleTable+=&&table width=\&0%\& border=\&0\& cellspacing=\&0\& cellpadding=\&0\&&&tr&&td&&;
titleTable+=&&a href=\&script:void(0)\& onclick=\&SloppyJs.calendar.getNewTime('b')\&
onfocus=\&this.blur()\& title='上月'&&&/a&&/td&&;
titleTable+=&&td class=\&threetd\& id=\&currentYear\& onclick=\&SloppyJs.calendar.writeDivString('currentYear','yeartype')\&& &/td&&;
titleTable+=&&td class=\&twotd\& id=\&currentMonth\& onclick=\&SloppyJs.calendar.writeDivString('currentMonth','monthtype')\&& &/td&&;
titleTable+=&&td&&a href=\&javascript:void(0)\& onclick=\&SloppyJs.calendar.getNewTime('n')\& onfocus=\&this.blur()\& title='下月'&&&/a&&/td&&/tr&&/table&&/div&&;
var SloppyJs={};
(function(){
SloppyJs.calendar={
getDateString:function(y,m){
var DayArray=[];
for(var i=0;i&42;i++) DayArray[i]=& &;
for(var i=0;i&new Date(y,m,0).getDate();i++)DayArray[i+new Date(y,m-1,1).getDay()]=i+1;
return DayA
getConString:function(y,m){
var DStr=&&table width=\&0%\& border=\&0\& cellspacing=\&0\& cellpadding=\&0\&&&tr&&;
var DateArray=['日','一','二','三','四','五','六'];
for(var i=0;i&7;i++){
DStr+=&&td&&+DateArray[i]+&&/td&&;
DStr+=&&/tr&&;
for(var i=0;i&6;i++){
DStr+=&&tr&&;
for(var j=0;j&7;j++){
var CS=new Date().getDate()==this.getDateString(y,m)[i*7+j]?&classOver&:&&;
if(this.getDateString(y,m)[i*7+j]==& &){
DStr+=&&td class='&+CS+&' id='dateNum&+(i*7+j)+&'onclick=\&SloppyJs.calendar.alertClick(event)\& &&+this.getDateString(y,m)[i*7+j]+&&/td&&;
DStr+=&&td class='&+CS+&' id='dateNum&+(i*7+j)+&' onclick=\&SloppyJs.calendar.alertClick(event)\&&&+this.getDateString(y,m)[i*7+j]+&&/td&&;
DStr+=&&/tr&&;
DStr+=&&/table&&;
rewriteConString:function(y,m){
var TArray=this.getDateString(y,m);
var len=TArray.
for(var i=0;i&i++){
document.getElementById('dateNum'+i).innerHTML=TArray[i];
document.getElementById('dateNum'+i).className=&&;
if(new Date().getYear()==y&&new Date().getMonth()+1==m&&new Date().getDate()==TArray[i]){
document.getElementById('dateNum'+i).className=&classOver&;
getNewTime:function(action){
var YearNO=document.getElementById('currentYear').innerHTML;
var MonthNO=document.getElementById('currentMonth').innerHTML;
if(action==&b&){
if(MonthNO==&1&){
MonthNO=13;
YearNO=YearNO-1;
document.getElementById('currentMonth').innerHTML=MonthNO-1;
document.getElementById('currentYear').innerHTML=YearNO;
this.rewriteConString(YearNO,MonthNO-1);
if(action==&n&){
if(MonthNO==&12&){
MonthNO=0;
YearNO=YearNO-(-1);
document.getElementById('currentYear').innerHTML=YearNO;
document.getElementById('currentMonth').innerHTML=MonthNO-(-1);
this.rewriteConString(YearNO,MonthNO-(-1));
writeDivString:function(){
var _element=document.getElementById(arguments[0]);
_element.style.position=&relative&;
var _value=_element.innerHTML;
if(arguments[1]==&yeartype&){
var _containerid=&yeardiv&;
if(document.getElementById(_containerid)){
var _c=document.getElementById(_containerid);
document.body.removeChild(_c);
if(document.getElementById(&monthdiv&)){
var _cc=document.getElementById(&monthdiv&);
document.body.removeChild(_cc);
var _container=document.createElement(&div&);
_container.setAttribute(&id&,_containerid);
_container.className=&yearContainer&;
var _ul=document.createElement(&ul&);
for(var i=0;i&15;i++){
var _li=document.createElement(&li&);
var _text=document.createTextNode(_value-7+i);
_li.appendChild(_text);
_ul.appendChild(_li);
_container.appendChild(_ul);
_container.style.top=_element.offsetTop+20+&px&;
_container.style.left=_element.offsetLeft+&px&;
document.body.appendChild(_container);
var _ali=document.getElementById(_containerid).getElementsByTagName(&li&);
for(var j=0;j&_ali.j++){
_ali[j].onmouseover=function(){
this.style.background=&#ff0000&;
this.style.color=&#FFFFFF&;
this.style.cursor=&pointer&;
_ali[j].onmouseout=function(){
this.style.background=&#ffffff&;
this.style.color=&#000000&;
_ali[j].onclick=function(){
document.getElementById(&yeardiv&).style.display=&none&;
_element.innerHTML=this.innerHTML;
var _alii=document.getElementById(_containerid).getElementsByTagName(&li&);
for(var k=0;k&_alii.k++){
_ul.removeChild(_alii[k]);
_container.removeChild(_ul);
document.body.removeChild(_container);
_element.style.position=&&;
var _y=document.getElementById('currentYear').innerHTML;
var _m=document.getElementById('currentMonth').innerHTML;
SloppyJs.calendar.rewriteConString(_y,_m);
_container.onmouseout=function(){
this.style.display=&none&;
_element.style.position=&&;
_container.onmouseover=function(){
this.style.display=&&;
if(arguments[1]==&monthtype&){
var _containerid=&monthdiv&;
if(document.getElementById(_containerid)){
var _c=document.getElementById(_containerid);
document.body.removeChild(_c);
if(document.getElementById(&yeardiv&)){
var _cc=document.getElementById(&yeardiv&);
document.body.removeChild(_cc);
var _container=document.createElement(&div&);
_container.setAttribute(&id&,_containerid);
_container.className=&monthContainer&;
var _ul=document.createElement(&ul&);
for(var i=0;i&12;i++){
var _li=document.createElement(&li&);
var _text=document.createTextNode(i+1);
_li.appendChild(_text);
_ul.appendChild(_li);
_container.appendChild(_ul);
_container.style.top=_element.offsetTop+20+&px&;
_container.style.left=_element.offsetLeft+&px&;
document.body.appendChild(_container);
var _ali=document.getElementById(_containerid).getElementsByTagName(&li&);
for(var l=0;l&_ali.l++){
_ali[l].onmouseover=function(){
this.style.background=&#ff0000&;
this.style.color=&#FFFFFF&;
this.style.cursor=&pointer&;
_ali[l].onmouseout=function(){
this.style.background=&#ffffff&;
this.style.color=&#000000&;
_ali[l].onclick=function(){
document.getElementById(_containerid).style.display=&none&;
_element.innerHTML=this.innerHTML;
var _alii=document.getElementById(_containerid).getElementsByTagName(&li&);
for(var k=0;k&_alii.k++){
_ul.removeChild(_alii[k]);
_container.removeChild(_ul);
document.body.removeChild(_container);
_element.style.position=&&;
var _y=document.getElementById('currentYear').innerHTML;
var _m=document.getElementById('currentMonth').innerHTML;
SloppyJs.calendar.rewriteConString(_y,_m);
_container.onmouseout=function(){
this.style.display=&none&;
_element.style.position=&&;
_container.onmouseover=function(){
this.style.display=&&;
alertClick:function(e){
var targets=e.target||event.srcE
alert(targets.innerHTML);
function writeCalendar(){
document.write(titleTable);
var _todayYear=document.getElementById('currentYear').innerHTML=new Date().getFullYear();
var _todayMonth=document.getElementById('currentMonth').innerHTML=new Date().getMonth()+1;
var _calendarStr=SloppyJs.calendar.getConString(_todayYear,_todayMonth);
document.write(_calendarStr+&&/div&&);
writeCalendar();
&/script&
&/body&
&/html&
------其他回答(25分)---------
两个帖子都贴了给分啊
------其他回答(5分)---------引用 10 楼 tangyu477 的回复:en 这个地址就是楼主要的/docs/products/dhtmlxScheduler/sample_basic.html看这个吧
如果公司非要人手写 我只能说你们公司的老板脑袋坏了.!------其他回答(10分)---------&Script LANGUAGE=&JavaScript&& &var months = new Array(&一&, &二&, &三&,&四&, &五&, &六&, &七&, &八&, &九&,&十&, &十一&, &十二&); &var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31); &var days = new Array(&日&,&一&, &二&, &三&,&四&, &五&, &六&); &var classT &var today=new getToday(); &var year=today. &var month=today. &var newC&
&function getDays(month, year) { & if (1 == month) return ((0 == year % 4) && (0 != (year % 100))) ||(0 == year % 400) ? 29 : 28; & else return daysInMonth[month]; &} &function getToday() { & this.now = new Date(); & this.year = this.now.getFullYear(); & this.month = this.now.getMonth(); & this.day = this.now.getDate(); &} &function Calendar() { & newCal = new Date(year,month,1); & today = new getToday();
& var day = -1; & var startDay = newCal.getDay(); & var endDay=getDays(newCal.getMonth(), newCal.getFullYear()); & var daily = 0; & if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth())) & { &
day = today. & } & var caltable = document.all.caltable.tBodies. & var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear()); & for (var intWeek = 0; intWeek & caltable.rows.intWeek++) &
for (var intDay = 0;intDay & caltable.rows[intWeek].cells.intDay++) &
var cell = caltable.rows[intWeek].cells[intDay]; &
var montemp=(newCal.getMonth()+1)&10?(&0&+(newCal.getMonth()+1)):(newCal.getMonth()+1);
if ((intDay == startDay) && (0 == daily)){ daily = 1;} &
var daytemp=daily&10?(&0&+daily):(daily); &
var d=&&&+newCal.getFullYear()+&-&+montemp+&-&+daytemp+&&&; &
if(day==daily) cell.className=&DayNow&; &
else if(intDay==6) cell.className = &DaySat&; &
else if (intDay==0) cell.className =&DaySun&; &
else cell.className=&Day&; &
if ((daily & 0) && (daily &= intDaysInMonth)) &
cell.innerText = &
daily++; &
cell.className=&CalendarTD&; &
cell.innerText = &&; &
} & } & document.all.year.value= & document.all.month.value=month+1; &} &function subMonth() &{ & if ((month-1)&0) & { &
month=11; &
year=year-1; & } else & { &
month=month-1; & } & Calendar(); &} &function addMonth() &{ & if((month+1)&11) & { &
month=0; &
year=year+1; & } else & { &
month=month+1; & } & Calendar(); &} &function setDate()&
&{ & if (document.all.month.value&1||document.all.month.value&12) & { &
alert(&月的有效范围在1-12之间!&); & & } & year=Math.ceil(document.all.year.value); & month=Math.ceil(document.all.month.value-1); & Calendar(); &}&/Script&&Script&function buttonOver(){ &var obj = window.event.srcE &obj.runtimeStyle.cssText = &background-color:#FFFFFF&;// obj.className=&Hover&;}function buttonOut(){ &var obj = window.event.srcE &window.setTimeout(function(){obj.runtimeStyle.cssText = &&;},300);}&/Script&&Style&Input {font-family:font-size: 9text-decoration:background-color: #FFFFFF;height: 20border: 1px solid #666666;color:#000000;}.Calendar {font-family:text-decoration:width: 170;background-color: #C0D0E8;font-size: 9border:0px dotted #1C6FA5;}.CalendarTD {font-family:font-size: 7color: #000000;background-color:#f6f6f6;height: 20width:11%;text-align:}.Title {font-family:font-size: 11font-weight:height: 24text-align:color: #333333;text-decoration:background-color: #A4B9D7;border-top-width: 1border-right-width: 1border-bottom-width: 1border-left-width: 1border-bottom-style:1border-top-color: #999999;border-right-color: #999999;border-bottom-color: #999999;border-left-color: #999999;}.Day {font-family:font-size: 7color:#243F65;background-color: #E5E9F2;height: 20width:11%;text-align:}.DaySat {font-family:font-size: 7color:#FF0000;text-decoration:background-color:#E5E9F2;text-align:height: 18width: 12%;}.DaySun {font-family:font-size: 7color: #FF0000;text-decoration:background-color:#E5E9F2;text-align:height: 18width: 12%;}.DayNow {font-family:font-size: 7font-weight:color: #000000;background-color: #FFFFFF;height: 20text-align:}.DayTitle {font-family:font-size: 9color: #000000;background-color: #C0D0E8;height: 20width:11%;text-align:}.DaySatTitle {font-family:font-size: 9color:#FF0000;text-decoration:background-color:#C0D0E8;text-align:height: 20width: 12%;}.DaySunTitle {font-family:font-size: 9color: #FF0000;text-decoration:background-color: #C0D0E8;text-align:height: 20width: 12%;}.DayButton {font-family: Wfont-size: 9font-weight:color: #243F65;cursor:text-decoration:}&/Style&&table border=&0& cellpadding=&0& cellspacing=&1& class=&Calendar& id=&caltable&&&thead& &
&tr align=&center& valign=&middle&&&
& &td colspan=&7& class=&Title&& &
&a href=&javaScript:subMonth();& title=&上一月& Class=&DayButton&&3&/a& &input name=&year& type=&text& size=&4& maxlength=&4& onKeyDown=&if (event.keyCode==13)& onKeyUp=&this.value=this.value.replace(/[^0-9]/g,'')&
onpaste=&this.value=this.value.replace(/[^0-9]/g,'')&& 年 &input name=&month& type=&text& size=&1& maxlength=&2& onKeyDown=&if (event.keyCode==13)& onKeyUp=&this.value=this.value.replace(/[^0-9]/g,'')&
onpaste=&this.value=this.value.replace(/[^0-9]/g,'')&& 月 &a href=&JavaScript:addMonth();& title=&下一月& Class=&DayButton&&4&/a& & &/td& &&/tr& &&tr align=&center& valign=&middle&&&
& &Script LANGUAGE=&JavaScript&& &
document.write(&&TD class=DaySunTitle id=diary && + days[0] + &&/TD&&);&
for (var intLoop = 1; intLoop & days.length-1;intLoop++)&
document.write(&&TD class=DayTitle id=diary&& + days[intLoop] + &&/TD&&);&
document.write(&&TD class=DaySatTitle id=diary&& + days[intLoop] + &&/TD&&);&
& &/Script& &&/TR&& &/thead&&TBODY border=1 cellspacing=&0& cellpadding=&0& ID=&calendar& ALIGN=CENTER ONCLICK=&getDiary()&& &&Script LANGUAGE=&JavaScript&& & for (var intWeeks = 0; intWeeks & 6; intWeeks++) & { &
document.write(&&TR style='cursor:hand'&&); &
for (var intDays = 0; intDays & days.intDays++) document.write(&&TD class=CalendarTD onMouseover='buttonOver();' onMouseOut='buttonOut();'&&/TD&&); &
document.write(&&/TR&&); & }&
&&/Script&&/TBODY&&/TABLE&&Script
LANGUAGE=&JavaScript&& &Calendar();&/Script&&p&查找更多代码,请访问:&a href=&& target=&_blank&&懒人图库&/a&&/p&相关资料:|||||||如何实现一个全年日历12个月缩略图在整个页面显示???内附图片。。。。。。。。。【标题要长】-Java/Web开发来源网络,如有侵权请告知,即处理!编程Tags:                &                    在jsp页面中如果实现图片上传预览效果
[问题点数:40分]
在jsp页面中如果实现图片上传预览效果
[问题点数:40分]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
2015年5月 Java大版内专家分月排行榜第二2013年5月 Java大版内专家分月排行榜第二
2011年5月 Java大版内专家分月排行榜第三2011年1月 Java大版内专家分月排行榜第三
2015年5月 Java大版内专家分月排行榜第二2013年5月 Java大版内专家分月排行榜第二
2011年5月 Java大版内专家分月排行榜第三2011年1月 Java大版内专家分月排行榜第三
2011年1月 Java大版内专家分月排行榜第二
本帖子已过去太久远了,不再提供回复功能。

我要回帖

更多关于 js实现在线预览word 的文章

 

随机推荐