C
Cloy
I'm working on a script that loads a page, and then jumps to an anchor
(based on the date). Everything works except getting the anchor format
correctly.
Here is the code...
<script type="text/javascript">
<!--
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var year = date.getFullYear();
onload=document.location='# + month + day + year';
// -->
</script>
Here is what the URL should look like...
http://www.someurl.com/thisfile.htm#02072007
(on 2/7/2007)
This is what I'm getting instead...
http://www.someurl.com/thisfile.htm# + month + day + year
Can someone help me with the syntax of the onload= line?
Thanks, in advance!
-Cloy
(based on the date). Everything works except getting the anchor format
correctly.
Here is the code...
<script type="text/javascript">
<!--
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var year = date.getFullYear();
onload=document.location='# + month + day + year';
// -->
</script>
Here is what the URL should look like...
http://www.someurl.com/thisfile.htm#02072007
(on 2/7/2007)
This is what I'm getting instead...
http://www.someurl.com/thisfile.htm# + month + day + year
Can someone help me with the syntax of the onload= line?
Thanks, in advance!
-Cloy