Rosa
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # HTML 表單 input ###### tags: `HTML` ### 表單基本語法 ```htmlmixed= <form action="表單資料處理目的地" method="傳送方式"> ``` :::info method的值有 GET 與 POST 兩種 * GET 較快,但資料會顯示在網址列,適合搜尋使用 * POST 較安全,適合個資或內容較多的資料 ::: * 輸入欄位 &lt;input&gt; ```htmlmixed= <input type="輸入欄位類型" name="欄位名稱" value="按鈕名稱文字"> ``` ![](https://i.imgur.com/ktuhjp0.png) |typr|| |---|---| |button |定義可點擊按鈕(多數情況下,用於通過JavaScript 啟動腳本)。| |checkbox| 定義復選框。| |file |定義輸入字段和"瀏覽"按鈕,供文件上傳。| |hidden |定義隱藏的輸入字段。| |image |定義圖像形式的提交按鈕。| |password |定義密碼字段。該字段中的字符被掩碼。| |radio |定義單選按鈕。| |reset |定義重置按鈕。重置按鈕會清除表單中的所有數據。| |submit |定義提交按鈕。提交按鈕會把表單數據發送到服務器。| |text |定義單行的輸入字段,用戶可在其中輸入文本。默認寬度為20 個字符。| --- ==練習:帳號密碼的登入欄位== ```htmlmixed= <body> <form action="login.php" method="POST"> <p>帳號:<input type="text" name="username"></p> <p>密碼:<input type="password" name="password"></p> <p><input type="submit" value="登入"><input type="reset" value="重置"></p> </form> </body> ``` ==練習:單選與多選框、預設選項== ```htmlmixed= <body> <form action="login.php" method="POST"> <p> 性別: <input type="radio" name="music" value="rock" checked>Rock <input type="radio" name="music" value="Pop">Pop <input type="radio" name="music" value="Jazz">Jazz </p> <p> 興趣: <input type="checkbox" name="sport" value="jog">慢跑 <input type="checkbox" name="sport" value="swin">游泳 <input type="checkbox" name="sport" value="balls">球類 <input type="checkbox" name="sport" value="other">其他 </p> </from> </body> ``` 顯示樣式: ![](https://i.imgur.com/hvlb9r3.png) --- ### 範圍點選 label * 若要使用&lt;label&gt; 標籤,&lt;input&gt; 輸入欄位就必須設定 id 欄位編號,因為&lt;label&gt; 標籤就是根據 id 屬性值來對應。 * 每個label對應一個input 格式如下: ```htmlmixed= <label for="欄位編號">顯示名稱</label> <input type=" " name=" " id="欄位標號"> ``` ==練習:使用&lt;label&gt;== ```htmlmixed= <form action="/action_page.php"> <label for="male">Male</label> <input type="radio" name="gender" id="male" value="male"><br> <label for="female">Female</label> <input type="radio" name="gender" id="female" value="female"><br> <label for="other">Other</label> <input type="radio" name="gender" id="other" value="other"><br><br> <input type="submit" value="Submit"> </form> ``` :::success 精簡版寫法:只要用label包住頭尾就可以了 <li><label><input id="btnRemember" type="checkbox" checked="checked" tabindex="4" /><span class="note">記住帳號</span></label></li> ::: --- ### 表單下拉選項 select ==練習下拉選項:== ```htmlmixed= <body> <form> <p> 請選擇季節: <select name="season"> <option name="spring">春天</option> <option name="summer">夏天</option> <option name="autumn">秋天</option> <option name="winter">冬天</option> </select> </p> </from> </body> ``` 顯示樣式: ![](https://i.imgur.com/AT0FjqO.png) --- ### 多選 mulpitle ctrl+滑鼠左鍵多選 ==練習多選:== ```htmlmixed= <body> <form> 請選擇季節: <select name="season" size="4" multiple> <option name="spring">春天</option> <option name="summer">夏天</option> <option name="autumn">秋天</option> <option name="winter">冬天</option> </select> </form> </body> ``` 顯示樣式: ![](https://i.imgur.com/kZpoLEE.png) --- ### 文字區域 textarea ```htmlmixed= <body> <form> <textarea name="pop" id="pop" cols="33" rows="10"> 一個一個的試題 輕輕放在你的生命裏 遇到問題  你是習慣平心靜氣 感恩珍惜  還是習慣滿腹怒氣 埋天怨地 如果你對上天的一切安排  人生的所有際遇 都心存感激滿懷謝意 相信你所面臨的壓力  必將啟發你無窮的潛力 如果你對命運的一切佈局  生活的所有點滴 都當作打擊滿懷敵意 就算你的腳本 是喜劇  也可能演出令人遺憾嘆息的悲劇 好壞全都掌握在自己手裏  除非你放棄 除非你不爭氣 一步一步會留下足跡  一言一行會留下成績  努力不懈會創造良機  主敬存誠會創造奇蹟 </textarea> </from> </body> ``` 顯示樣式: ![](https://i.imgur.com/EZVvSiD.png) --- ### 表單群組元件:&lt;fieldset&gt;、&lt;legend&gt; 可以幫表單分區塊的標籤~ ==表單分區練習:== ```htmlmixed= <body> <form> <fieldset> <legend>登入資訊</legend> <p> <label for="username">帳號:</label> <input type="text" name="username" id="username"> </p> </fieldset> <fieldset> <legend>登入資訊</legend> <p> <label for="username">帳號:</label> <input type="text" name="username" id="username"> </p> </fieldset> </form> </body> ``` 顯示樣式: ![](https://i.imgur.com/nAuvrYP.png) --- ### HTML5新增格式 ![](https://i.imgur.com/YHKrX4P.png) ![](https://i.imgur.com/y8f7tq5.png) * maxlength * <input> 元素的 maxlength 屬性用來限制輸入欄位的可輸入字數(the number of characters) `<input type="text" maxlength="5">` * pattern 驗證格式 參考 1.第一個字必須為大小寫英文或數字 <input type="text" pattern="[a-zA-Z0-9]"> 2.前三個字必須為大小些英文或數字 <input type="text" pattern="[a-zA-Z0-9]{3}"> 3.全部都必須為大小寫英文或數字 <input type="text" pattern="[a-zA-Z0-9]*"> 4.驗證內容為電子郵件 <input type="text" name="email2" pattern="[a-z0-9._%+-]=@[a-z0-9.-]=\.[a-z]{2,4}$"> :::info HTML 正規表示法 可參考 https://bit.ly/2Rmtn1T ::: ==練習HTML5新增語法== ```htmlmixed= <body> <form action=""> <fieldset> <legend>基本資料</legend> <p>姓名:<input type="text" name="username" placeholder="請輸入姓名" required autofocus></p> <p>搜尋:<input type="search" name="search" placeholder="輸入關鍵字"></p> <p>信箱:<input type="email" name="email" placeholder="abc@mail.com"></p> <p>信箱2:<input type="text" name="email2" placeholder="abc@mail.com" pattern="[a-z0-9._%+-]=@[a-z0-9.-]=\.[a-z]{2,4}$"></p> <p>網址:<input type="url" name="url" placeholder="請輸入網址"></p> <p>電話:<input type="tel" name="tel" placeholder="連絡電話" autocomplete="off"></p> <p>數字:<input type="number" name="number" min="1" max="21" step="3"></p> <p>日期: <input type="date" name="date"></p> <p>時間: <input type="time" name="time"></p> <p>程度: <input type="range" name="range"></p> <p>顏色: <input type="color" name="color"></p> <!-- 傳送資料 --> <p><input type="submit" value="送出"> <input type="reset" value="重置"> </p> </fieldset> </form> </body> ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully