フォームacceptCharsetプロパティ
例
サーバーがフォーム送信に使用する文字セットを返します。
var x = document.getElementById("myForm").acceptCharset;
定義と使用法
acceptCharsetプロパティは、フォーム要素のaccept-charset属性の値を設定または返します。
accept-charset属性は、フォームの送信に使用される文字セットを指定します。
デフォルト値は予約文字列「UNKNOWN」です(エンコーディングが<form>要素を含むドキュメントのエンコーディングと等しいことを示します)。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
acceptCharset | Yes | Yes | Yes | Yes | Yes |
構文
acceptCharsetプロパティを返します。
formObject.acceptCharset
acceptCharsetプロパティを設定します。
formObject.acceptCharset = character-set
プロパティ値
Value | Description |
---|---|
character-set | A space- or comma-separated list of one or more character encodings that are to be used for the form submission.
Common values:
In theory, any character encoding can be used, but no browser understands all of them. The more widely a character encoding is used, the better the chance that a browser will understand it. To view all available character encodings, go to our Character sets reference. |
技術的な詳細
戻り値: | サーバーがフォーム送信に使用する文字セットを表す文字列 |
---|
その他の例
例
フォームのaccept-charset属性の値をUTF-8に変更します。
document.getElementById("myForm").acceptCharset = "UTF-8";
関連ページ
HTMLリファレンス:HTML <form> accept-charset属性
❮フォームオブジェクト