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;}'/>
"
;
}
查看全文
相关阅读:
VMware虚拟机下Centos8 设置静态IP地址
maven插件使用及dockerfile插件多模块下打包
Docker开启远程访问、IDEA Docker 连接 linux 上的 Docker
Docker打包错误:Failed to execute goal com.spotify:docker-maven-plugin:1.2.0:build (default-cli) on project security
Idea 中 Docker 的 log 乱码
oracle11G 已开启监听,但远程连接依旧无监听解决过程
sql server特殊功能:临时表是否存在
sql server object_id()的应用
sql server系统表详细说明
SQL行转列汇总
原文地址:https://www.cnblogs.com/nasdaqhe/p/542008.html
最新文章
通过python获取Windows的生产ip,掩码和网关
比特币大事件
gitee传入公钥以后每次push依然需要输入密码
Vscode设置vue文件换行问题
React Hook 入门使用
一招解决chrome(谷歌)浏览器打开文件选择框响应速度慢的问题
unity3d支持typescript开发
Centos8安装Redis
如何快速生成tsconfig.json文件
解决Android启动图拉伸问题
热门文章
代码添加注释信息
linux : IFS
Linux : xargs
容器镜像文件
容器镜像
开源项目目录
百度ai文字识别具体应用实例
基于N-gram算法解决实际应用场景中的重复问题
Logstash 7.7 x+导出官网 java 插件为离线包,重安装失败bug:ERROR: Something went wrong when installing file:///xxx, message: Illformed requirement ["=java_xxx"]
gradle构建java编写的logstash插件错误No signature of method: org.gradle.api.internal.tasks.DefaultTaskDependency
Copyright © 2011-2022 走看看