salmanelahi
Programmer
Hi everyone
I am trying to call a very very simple external javascript in a jsp page. This script works fine when is in the jsp file but when i try to call it by
<script src=selectCss.js></script> or
<script src="${pageContext.request.contextPath}/docroot/samples/js/selectCss.js"></script>
it does not work. No doubt it is being accessed in the jsp file because if i put a statment like
document.write(navigator.appName) it shows the name of the browser on the page but do not set Css anyway.
this is the code for javascript (and there are no tags in the js file :
if(navigator.appName == "Netscape")
{
document.write('<link ="stylesheet" type="text/css" href=""${pageContext.request.contextPath}/docroot/samples/css/NS_homeRp.css"/>');
}
if(navigator.appName == "Microsoft Internet Explorer")
{
document.write('<link ="stylesheet" type="text/css" href=""${pageContext.request.contextPath}/docroot/samples/css/NS_homeRp.css"/>');
}
thanx a lot,
Salman
I am trying to call a very very simple external javascript in a jsp page. This script works fine when is in the jsp file but when i try to call it by
<script src=selectCss.js></script> or
<script src="${pageContext.request.contextPath}/docroot/samples/js/selectCss.js"></script>
it does not work. No doubt it is being accessed in the jsp file because if i put a statment like
document.write(navigator.appName) it shows the name of the browser on the page but do not set Css anyway.
this is the code for javascript (and there are no tags in the js file :
if(navigator.appName == "Netscape")
{
document.write('<link ="stylesheet" type="text/css" href=""${pageContext.request.contextPath}/docroot/samples/css/NS_homeRp.css"/>');
}
if(navigator.appName == "Microsoft Internet Explorer")
{
document.write('<link ="stylesheet" type="text/css" href=""${pageContext.request.contextPath}/docroot/samples/css/NS_homeRp.css"/>');
}
thanx a lot,
Salman