此方法創建一個用作超文本目標的HTML錨。
語法
string.anchor( anchorname )
下面是參數的詳細信息:
返回值:
例子:
<html>
<head>
<title>JavaScript String anchor() Method</title>
</head>
<body>
<script type="text/javascript">
var str = new String("Hello world");
alert(str.anchor( "myanchor" ));
</script>
</body>
</html>
這將產生以下結果:
<a name="myanchor">Hello world</a>