JavaScript位置对象replace()方法示例
<!DOCTYPE html> <html> <head> <script type="text/javascript"> function replaceDoc() { window.location.replace("https://onitroad.com/jc/js/index.html") } </script> </head> <body style ="background-color:yellow"> <input type="button" value="Replace site" onclick="replaceDoc()" /> </body> </html>
JavaScript位置对象replace()方法
- 位置对象Location包含有关当前URL的信息。
- 位置对象Location具有一个名为replace()方法的方法,该方法用另一个文档替换当前文档。
语法
location.replace(newurl)
日期:2020-04-18 01:09:24 来源:oir作者:oir