
js脚本怎么调用一个.html的文件
想通过js调用一个index.html的文件这个html文件也在当前项目目录下可是我用window.open('../bookPlay/index.html');这种方法...
想通过js 调用 一个 index.html的文件 这个html文件也在当前项目目录下 可是我用window.open('../bookPlay/index.html'); 这种方法调用总是报404
展开
2个回答
展开全部
应该是目录结构不对,打个比方:
你的当前文件是
/index.html
你的js是
/js/fun.js
你需要调用的是
/bookPlay/index.html
这个时候你需要以/index.html为当前位置
调用的话就是window.open('bookPlay/index.html');
或者更安全的用绝对路径
window.open('/bookPlay/index.html');
你的当前文件是
/index.html
你的js是
/js/fun.js
你需要调用的是
/bookPlay/index.html
这个时候你需要以/index.html为当前位置
调用的话就是window.open('bookPlay/index.html');
或者更安全的用绝对路径
window.open('/bookPlay/index.html');
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询