<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>定义input type="file" 的样式</title> <style type="text/css"> </style> </head> <body> <div > <form action="" method="post" enctype="multipart/form-data"> <textarea id="textfield" style="width:400px;height:300px"></textarea> <br/> <div style="float:left"> <button style="width:100px;height:100px;font-size:20px;text-align:center;" value=‘浏览...‘ >浏览...</button> </div> <div style="float:left"> <input type="file" name="fileField" style="opacity:0;width:100px;height:100px;margin-left:-100px;text-align:center" id="fileField" onchange="document.getElementById(‘textfield‘).value=this.value"/> </div> <div style="float:left"> <button type="submit" name="submit" style="margin-left:5%;width:100px;height:100px;font-size:20px" value="上传" >上传</button> </div> </form> </div> </body> </html>
时间: 2025-01-04 17:08:42