运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,暗色/亮色
前往 Spaces
<!DOCTYPE html> <html> <body> <p><a id="myAnchor" target="_blank" href="http://www.example.com:80/test.htm#part2">Example link</a></p> <p>Click the button to change the pathname of the link above.</p> <p><b>Tip:</b> Open the link and look in the address bar before and after you have clicked the "Try it" button, to see the effect.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myAnchor").pathname = "newpathname"; document.getElementById("demo").innerHTML = "The pathname was changed from 'test' to 'newpathname'"; } </script> </body> </html>