I am making a game in JavaScript and when the user wins/loses I am prompted them if they would like to play again.
Instead of reseting all the vars, is there a way to just reload the page?
答案 0 :(得分:2)
localhost
重新加载当前文档。
答案 1 :(得分:2)
当然,请使用[{"units": [{"name": "unit1", "projects": ["project1", "project2"]}, {"name": "unit2", "projects": ["project1", "project2"]}], "name": "org1"}, {"units": [{"name": "unit1", "projects": ["project1", "project2"]}], "name": "org2"}]
:
reload
您还可以使用location.reload();
方法加载其他文档:
replace
答案 2 :(得分:1)
你走了:
window.location.reload();
答案 3 :(得分:1)
您可以使用window.location.reload()
。
就像刷新按钮
一样