js调用刷新界面的几种方式

有的时候需要手动调用来刷新界面,比如非动态切换的语言模式啊,风格样式啊什么的。

<!DOCTYPE html> <html> <head> <meta charset='utf-8'> </head> <body> <button>location.reload();</button> <button>history.go(0);</button> <button> location=location ;</button> <button>location.assign(location) ;</button> <button>location.replace(location) ;</button> <script> function click1 () { //刷新清缓存,相当于Ctrl+F5:location.reload(true) //普通刷新:location.reload() location.reload(); } function click2(){ history.go(0); } function click3(){ location=location; } function click4(){ location.assign(location) ; } function click5(){ location.replace(location) } </script> </body> </html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wypyxf.html