JavaScript anchor()メソッド
JavaScript String オブジェクト
定義と使い方
anchor() メソッドは HTML アンカーを作成するために使用されます。
このメソッドは <a> タグで囲まれた文字列を返します。次のようになります:
構文
string.anchor(name)
| パラメータ | 説明 |
|---|---|
| name | Required. The name of the anchor |
ブラウザサポート
![]()
![]()
![]()
![]()
![]()
すべての主要ブラウザが anchor() メソッドをサポートしています。
例
例
HTML アンカーを作成する:
<script>
var txt = "Chapter 10";
txt.anchor("chap10");
alert(txt.anchor("chap10"));
</script>
var txt = "Chapter 10";
txt.anchor("chap10");
alert(txt.anchor("chap10"));
</script>
試してみる »
JavaScript String オブジェクト その他の拡張