-2
我想要jquery查找并更改您正在访问的当前URL并加载新的URL。可以说,jquery应该将当前的“index.html”更改为“indexalt.html”,然后加载它。我的想法是使用document.URL获取当前的URL,然后在最后切掉“.html”,并将例如“alt.html”添加到字符串中。我对jquery很陌生,不想让它工作。会有很多错误的可能是我的脚本中:更改当前URL然后加载
$("#contact").on('click', function() {
var url=document.URL(str.slice(-7));
.load("url +"alt.html"");
我会很感激,如果有人能告诉我该怎么做,以及如何将其正确写下一个整体。谢谢!
'了window.location = window.location.slice(0,-5)+“alt.html'' – adeneo
document.URL ??? – epascarello