我正在向某人发送我正在创建的网站的草稿。然而,根据网站的设计方式,主屏幕是一个“a href”链接,即“#home”。当我从计算机打开网站时,它会转到 ...../Index.html,但我需要它在页面加载时转到 ..../Index.html#home。这怎么可能呢?
最佳答案
在脚本部分使用此脚本
window.onload = function (event) { window.location.hash = "#home"; };
关于javascript - 从 Index.html 更改为 Index.html#home,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38288406/