Anchor charsetプロパティ

Anchor 对象参考手册Anchorオブジェクト

定義と使い方

charset はリンクの charset プロパティの値を設定または返します。

charset プロパティは、リンク先リソースの文字セットを指定します。

構文

charset プロパティを設定する:

anchorObject.charset="charset"

charset プロパティを返す:

anchorObject.charset

值 説明
charset リンク先リソースの文字セットを指定します


ブラウザサポート

Internet ExplorerFirefoxOperaGoogle ChromeSafari

すべての主要ブラウザが charset プロパティをサポートしています


例

例

リンクの charset プロパティの値を返す:

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>サンプル(example.com)</title> </head> <body> <a id="サンプル" charset="ISO-8859-1" href="//www.example.com/">サンプル</a><br> <script>document.write("戻りリンクのcharset: "); document.write(document.getElementById('サンプル').charset); document.write("<br><br>"); </script> <a id="google" href="//www.google.com/">Google</a><br> <script>document.getElementById('google').charset="utf-8"; document.write("设置链接のcharset: "); document.write(document.getElementById('google').charset);</script> </body> </html>

試してみる »


Anchor 对象参考手册Anchorオブジェクト その他の拡張