PDA

View Full Version : Loading JS file in day of the month



hnpdyn
02-08-2006, 08:03 AM
Please help me. I want to load js file in html.
For example, today in the Feb 6, 2006.
I want the script load the file 6.js

<HTML><HEAD><TITLE>LOADING JS</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var today = new Date();
var day = today.getDate();
// End -->
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT type="text/javascript">
document.write('<SCRIPT src="'+day+'.js" type="text/javascript"></SCRIPT>');
</SCRIPT>
</BODY>
</HTML>

THANK YOU

jscheuer1
02-08-2006, 09:16 AM
You need to at least escape the closing script tag:


document.write('<script src="'+day+'.js" type="text/javascript"><\/script>');

You may have to break it up as well:


document.write('<script src="'+day+'.js" type="text/javascript"><\/'+'script>');

hnpdyn
02-08-2006, 07:31 PM
It's work now :-)