javascript - 在 html 文件之间导航

标签 javascript html

我有两个 html 文件 index.html 和 test.html,我想在按下按钮时从索引导航到测试。

我试过了,但效果不佳。

function change_page(){
   console.log("change_page");
   $('body').load( "test.html");
} 


<input type="button" value="create page" onclick="change_page();"/>

如果你有更好的方法,请告诉我。

最佳答案

function change_page(){
  window.location.href = "test.html";
} 


<input type="button" value="create page" onclick="change_page()"/>

关于javascript - 在 html 文件之间导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24903148/

相关文章:

html - 具有半透明边框的 CSS 线性渐变

html - 如何在不更改样式的情况下更改输入边框颜色?

javascript - 从超链接调用 Javascript 函数

javascript - 如何动态使用访问数组?

jquery - 具有响应式布局的 Bootstrap 下拉菜单

javascript - 仅在 Safari 中加载后 Google Maps API 修改页面样式

html - Bootstrap 4 折叠导航栏不工作

javascript - 用户单击提交时等待指示器

javascript - 暂停和播放事件会更改 jquery 中的 CSS

javascript - 将 HTML5 数据类型转换为数字