zoukankan
html css js c++ java
javascript实现图片预览
<
input name
=
"
w_s
"
type
=
"
file
"
id
=
"
w_s
"
onChange
=
"
load_img(this.value,img_s);
"
>
<
input name
=
"
w_b
"
type
=
"
file
"
id
=
"
w_b
"
onChange
=
"
load_img(this.value,img_b);
"
>
<
div id
=
"
img_s
"
></
div
>
<
div id
=
"
img_b
"
></
div
>
<
script language
=
"
javascript
"
>
<!--
function
load_img(p_src,write_id)
{
var
t_html;
if
(p_src
!=
'')
{
if
(write_id
==
img_s)
{
t_html
=
"
<img src='
"
+
p_src
+
"
' onLoad='javascript:if(this.width>120){this.width=120;}if(this.height>120){this.height=120;}'>
"
;
}
else
{
t_html
=
"
<img src='
"
+
p_src
+
"
' onLoad='javascript:if(this.width>240){this.width=240;}if(this.height>240){this.height=240;}'>
"
;
}
}
else
{
t_html
=
""
;
}
write_id.innerHTML
=
t_html;
}
//
-->
function
change()
{
if
(form1.fType.value
==
0
)
{
labeltxt.innerText
=
"
图片预览:
"
;
showtxt.style.display
=
"
none
"
;
showpic.style.display
=
"
block
"
;
}
else
{
labeltxt.innerText
=
"
文字(txt):
"
;
showpic.style.display
=
"
none
"
;
showtxt.style.display
=
"
block
"
;
}
}
function
show()
{
showpic.innerHTML
=
"
<img src='
"
+
form1.file.value
+
"
' onLoad='javascript:if(this.width>256){this.height=this.height/(this.width/256);this.width=256;}if(this.height>256){this.width=this.width/(this.height/256);this.height=256;}'/>
"
;
}
查看全文
相关阅读:
反思二
安装Electron时卡在install.js不动的解决方案
解决npm 下载速度慢的问题
覆盖第三方jar包中的某一个类。妙!!
关于拦截器是用注解方便,还是用配置文件写死方便的总结。
yapi 启动后,老是自动关闭的问题。
BaseResponse公共响应类,与我的设计一模一样,靠、ApiResponse
HashMap 的 7 种遍历方式与性能分析!(强烈推荐)、forEach
Jackson objectMapper.readValue 方法 详解
yapi tag的问题,暂时只保留一个tag
原文地址:https://www.cnblogs.com/nasdaqhe/p/542008.html
最新文章
HTML5开启浏览器桌面通知 Web Notification
count(1)、count(*)、count(字段)的区别
SQL回顾1
Git初始化本地仓库及管理远程仓库github
单例模式——8种实现方式
单例模式应用场景
单例模式——5种实现方式
HashMap不能使用基本数据类型作为key
代码解释n |= n >>> 16
Java序列化
热门文章
SSM框架搭建过程
Roslyn入门(一)-C#语法分析
.Net并行编程(一)-TPL之数据并行
VitualBox安装linux记录
性能提升五十倍:消息队列延时聚合通知的重要性
ElasticSearch实践系列(三):探索数据
ElasticSearch实践系列(二):探索集群
ElasticSearch实践系列(一):安装
.Net版本依赖之坑引发的搜查
OpenTracing:开放式分布式追踪规范
Copyright © 2011-2022 走看看