JavaScript link() 方法


定义和用法

link() 方法用于把字符串显示为超链接。

语法
  1. stringObject.link(url)
参数 描述
url 必需。规定要链接的 URL。

实例

在本例中,"Free Web Tutorials!" 将被显示为超链接:

  1. <html>
  2. <body>
  3. <script type="text/javascript">
  4. var str="Free Web Tutorials!"
  5. document.write(str.link("https://cankaoshouce.com"))
  6. </script>
  7. </body>
  8. </html>

分类导航