如果页面名为mypage.html,我想让下面的javascript更新特定的css链接bootstrap.min.js。
我该怎么做?如何让JavaScript修改基于页面名称的CSS链接?
<html>
<head>
<link rel="stylesheet" type="text/css" href="/css/bootstrap377.min.css"/>
<link rel="stylesheet" type="text/css" href="/css/some_other_stylesheet.css"/>
<script type="text/javascript">
var filename = location.href.split("/").slice(-1);
if (filename == "mypage.html") {
HOW DO I DO THIS: update the above stylesheet link to be bootstrap400.min.css (or should this script be before the css link?)
}
</script>
</head>
<body>
this is a test
</body>
</html>
不能从HTML – Nelu
我的例子已经访问访问文件名的文件名,我需要的脚本来修改CSS链接 – user3302169