當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


HTML input file用法及代碼示例

HTML <input type =“ file”>用於指定文件選擇字段,並添加按鈕以選擇要上傳到表單的文件。

用法:

<input type="file"> 

例:

<!DOCTYPE html>  
<html>  
  
<head>  
    <title>  
        HTML input type file 
    </title>  
      
    <style>  
        h1 {  
            color:green;  
        }  
        h3 {  
            font-family:Impact;  
        }  
        body {  
            text-align:center;  
        }  
    </style>  
</head>  
  
<body>  
    <h1>  
        GeeksforGeeks  
    </h1>  
      
    <h3>  
        HTML <Input Type = "File">  
    </h3>  
  
    <input type="file" id="myFile">  
      
    <p id="submit_text"></p> 
</body>  
  
</html>                    

輸出:

支持的瀏覽器:<input type =“ file”>支持的瀏覽器如下:

  • 穀歌瀏覽器1.0
  • IE瀏覽器
  • Firefox 1.0
  • Safari 1.0
  • Opera 1.0




相關用法


注:本文由純淨天空篩選整理自ManasChhabra2大神的英文原創作品 HTML | <input type=”file”>。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。