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;}'/>
"
;
}
查看全文
相关阅读:
scss文件报错处理 (报错信息Invalid CSS after "v": expected 1 selector or at-rule, was 'var api = require)
vue-countdown组件
vue dayjs in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js
vue you can run: npm install --save !!vue-styles-loader!css-loader?
解决npm报错:Module build failed: TypeError: this.getResolve is not a function
【JVM从小白学成大佬】3.深入解析强引用、软引用、弱引用、幻象引用
【JVM从小白学成大佬】2.Java虚拟机运行时数据区
【JVM从小白学成大佬】开篇
【必知必会】深入解析强引用、软引用、弱引用、幻象引用
【不做标题党,只做纯干货】HashMap在jdk1.7和1.8中的实现
原文地址:https://www.cnblogs.com/nasdaqhe/p/542008.html
最新文章
【转】生活的智慧
调度系统Airflow的第一个DAG
使用Makefile构建Docker
调度系统Airflow1.10.4调研与介绍和docker安装
vim基础命令,查找和替换
定时清理docker私服镜像
如何使用Python连接ldap
openldap介绍和使用
给debian的docker容器添加crontab定时任务
docker挂载volume的用户权限问题,理解docker容器的uid
热门文章
Docker volume speed up npm install
如何挑选node docker镜像
switch的对象不能为null
如何忽略Findbugs的bug
Ubuntu18.04下修改快捷键
安利一波ubuntu18.04作为开发环境,极度舒适
vue中使用localStorage存储信息
vue npm run dev 报错:missing script:dev
vue 调用接口配置
vue 项目中使用scss
Copyright © 2011-2022 走看看