如何在 HTML 中使用 telephone 輸入型別?
telephone 輸入型別在 HTML 中使用 <input type="tel">。使用此型別,允許使用者新增電話號碼。
注意 - 輸入型別 tel 僅在 Safari 中受支援。
示例
你可以嘗試執行以下程式碼,瞭解如何使用輸入型別 tel 讓使用者輸入電話號碼 -
<!DOCTYPE html> <html> <head> <title>HTML input search</title> </head> <body> <form action = "" method = "get"> Details:<br><br> Student Name<br><input type = "name" name = "sname"><br> Student Telephone<br> <input type = "tel" name = "telephone"><br> <input type = "submit" value = "Submit"> </form> </body> </html>
廣告