点评:点击a标签实现弹出input file上传文件对话框,html、css、如下感兴趣的朋友可以参考下哈,希望对你有所帮助
html
XYLHTML5中文学习网 - HTML5先行者学习网 XYLHTML5中文学习网 - HTML5先行者学习网
<SPAN class=tag><<SPAN class=title>div</SPAN>></SPAN> XYLHTML5中文学习网 - HTML5先行者学习网
<SPAN class=tag><<SPAN class=title>a</SPAN> <SPAN class=attribute>href</SPAN>=<SPAN class=value>"###"</SPAN>></SPAN>添加图片<SPAN class=tag></<SPAN class=title>a</SPAN>></SPAN> XYLHTML5中文学习网 - HTML5先行者学习网
<SPAN class=tag><<SPAN class=title>input</SPAN> <SPAN class=attribute>type</SPAN>=<SPAN class=value>"file"</SPAN> <SPAN class=attribute>name</SPAN>=<SPAN class=value>"image"</SPAN> <SPAN class=attribute>class</SPAN>=<SPAN class=value>"hidden"</SPAN> <SPAN class=attribute>value</SPAN>=<SPAN class=value>""</SPAN> /></SPAN> XYLHTML5中文学习网 - HTML5先行者学习网
<SPAN class=tag></<SPAN class=title>div</SPAN>></SPAN> XYLHTML5中文学习网 - HTML5先行者学习网
XYLHTML5中文学习网 - HTML5先行者学习网css
XYLHTML5中文学习网 - HTML5先行者学习网 XYLHTML5中文学习网 - HTML5先行者学习网
<SPAN class=class>.hidden</SPAN> <SPAN class=rules>{ XYLHTML5中文学习网 - HTML5先行者学习网
<SPAN class=rule><SPAN class=attribute>display</SPAN>:<SPAN class=value> none;</SPAN></SPAN> XYLHTML5中文学习网 - HTML5先行者学习网
<SPAN class=rule>}</SPAN></SPAN> XYLHTML5中文学习网 - HTML5先行者学习网
XYLHTML5中文学习网 - HTML5先行者学习网 XYLHTML5中文学习网 - HTML5先行者学习网
jquery XYLHTML5中文学习网 - HTML5先行者学习网
$('a').on('click', function(e) { XYLHTML5中文学习网 - HTML5先行者学习网
e.preventDefault(); XYLHTML5中文学习网 - HTML5先行者学习网
$(this).closest('input[type=file]').trigger('click'); XYLHTML5中文学习网 - HTML5先行者学习网
}) XYLHTML5中文学习网 - HTML5先行者学习网