直接给出 我笔记中的代码 如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>清空 input type="file" 里面已经选择的路径</title> </head> <body> <form action="#" method="post"> <input name="filePath" type="file" /> <input type="button" value="清空" onclick="fielPath.createTextRange().execCommand("delete")" /> </form> </body> </html>Over !!!
本文提供了一段HTML和JavaScript代码,用于清空input type=file元素中的选择路径,帮助开发者轻松实现文件选择框的清空功能。
328

被折叠的 条评论
为什么被折叠?



