运行 ❯
获取您
自身的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript String Methods</h1> <h2>The anchor() Method</h2> <p id="demo1"></p> <p>The anchor() method is deprecated in JavaScript.</p> <p>Use the a tag instead:</p> <p id="demo2"></p> <script> let text = "Hello World!"; let result = text.anchor("Chapter 10"); document.getElementById("demo1").innerHTML = result; result = "<a name='Chapter 10'>" + text + "</a>"; document.getElementById("demo2").innerHTML = result; </script> </body> </html>