input 탭의 type에 여러 text나hidden을 지정하면 어느 것이 우선입니까?

6691 단어 HTML

개시하다

input 태그의 type 속성에 여러 값을 지정하면 어떻게 되는지 궁금해서 검증했습니다.

소스 코드


index.html
<!DOCTYPE html>
<html lang="ja">
    <head>
        <meta charset="UTF-8">
    </head>

    <body>
        <form method="post" action='sample.php'>
            <input  type='text'     name='sample1' value="text"><br>
            <input  type='hidden'   name='sample2' value="hidden"><br>
            <input  type='password' name='sample3' value="password"><br>
            <input  type='url'      name='sample4' value="http://url.url"><br>

            <!-- ここからミックス -->
            <input  type='text hidden'   name='sample5'  value="text hidden"><br>
            <input  type='hidden text'   name='sample6'  value="hidden text"><br>
            <input  type='text password' name='sample7'  value="text passowrd"><br>
            <input  type='password text' name='sample8'  value="password text"><br>
            <input  type='text url'      name='sample9'  value="text url"><br>
            <input  type='url text'      name='sample10' value="url text"><br>
            <input  type='hidden hidden' name='sample11' value="hidden hidden"><br>
            <input  type='text hidden passowrd url' name='sample12' value="text hidden password url"><br>

            <button type='submit'>送信</button><br>
        </form>
    </body>
</html>
sample.php
<?php
echo('<pre>');
var_dump($_POST);
echo('</pre>');

결실


스크린



우편함 가격



고찰하다.

  • text hidden 화면에 표시되므로 hidden 유효하지 않음
  • 처음에 지정한 내용을 반영합니까?hidden text 그러나 hidden는 작용하지 않는다
  • password의 속성도 마찬가지password가 작용하지 않는다(입력란의 없음 ● ● 그런 복자)
  • 상기 상태에서 발송url할 수 있기 때문에 속성도 작용하지 않는다
  • 결론


    type에서 여러 속성을 지정할 수 없습니다.


    생각해보면 당연한 일type='hidden'이지만 type='hidden url' 준비가 되지 않아 무효로 판단되는 속성이 기본값이 된다.
    이를 통해 알 수 있듯이 input의 기본값typetext이기 때문에 조합이 지정한 모든 것을 text의 행위로 표시한다.
    신뢰할 수 있음

    참고 자료


    type 속성 일람은 여기를 참조합니다.
    http://honttoni.blog74.fc2.com/blog-entry-138.html

    좋은 웹페이지 즐겨찾기