我正在使用下面的代码来加载基于window.location元素的css文件。在if条件中使用window.location在CSS文件之间切换
<core:if test="${window.location.hostname == 'localhost'}">
<link href="././css/imageload.css" media="screen" rel="stylesheet" type="text/css" />
</core:if>
尽管window.location.hostname是'localhost',但测试总是返回false事件。我已经使用警告框进行了测试。
我在这里做错了什么?或者有没有其他的方式来比较window.location.hostname元素?
(我使用的是Spring框架,前端是Javascript + CSS)
这段代码在JavaScript或Java中运行? – kirilloid 2012-03-28 07:12:21
@kirilloid Javascript – Chillax 2012-03-28 07:14:13
@Chillax不知道为什么你在@ -ing me:s – 2012-03-28 07:14:54