電話番号入力フォームのmaxlength
次のような電話番号入力フォームは正しくできていると言えるでしょうか?
<input type="text" size="20" maxlength="4" value="" name="tel1" id="tel1" /> -
<input type="text" size="20" maxlength="4" value="" name="tel2" id="tel2" /> -
<input type="text" size="20" maxlength="4" value="" name="tel3" id="tel3" />
答えはNo。その理由は
、と職場のTDさんが教えてくれました。5桁の市外局番が存在するなんて、知らなかったです・・・。maxlength="5" にすべきだから
[memo]Flashより全面に、HTMLの要素を表示したい場合の指定
Flash呼び出しのobjectタグに
<param name="wmode" value="transparent" />
を加える。あとはz-indexプロパティの調整など。
HTML4.01 のコメント記述について
White space is not permitted between the markup declaration open delimiter("<!") and the comment open delimiter ("--"), but is permitted between the comment close delimiter ("--") and the markup declaration close delimiter (">"). A common error is to include a string of hyphens ("---") within a comment. Authors should avoid putting two or more adjacent hyphens inside comments.
3.2.4 Comments - HTML 4.01 Specification から引用
コメント内に二つ以上の連続するハイフン(-)を含むことは避けるべき、というのは割と有名な話。Validationでひっかかりますからね。
ここで目から鱗なのは、コメント開始の <! と -- の間に空白文字を含むことは許されないが、コメント終了の -- と > の間に空白文字を含むことが許される、というところ。ということは
<!--
コメントだよ!!
-- >
みたいなコードが仕様上はOKということ。
では実際のユーザーエージェントはこのコメントをどう解釈するんでしょう。 -- > みたいなコードをコメント終了とみなしてくれるのでしょうか。
手元にあるいくつかのブラウザで表示確認したところ
| IE6 / 7 | × |
|---|---|
| Firefox3 | ○ |
| Safari3 | × |
| Opera9 | × |
という結果に。ダメだこれは。。
しかも、大抵のエディタは -- > をコメント終了とみなしてはくれないようで、編集画面のシンタックスハイライトがおかしくなってしまいます。ということで、コメント終了は --> とするのが正解・・・。