0

I have the following:

<!DOCTYPE html>
<html>
<body>

<script>

var t = new Date();
var m = t.getMonth()+1;
var d = t.getDate();

mm = m.toString();
dd = d.toString();

var textfile = mm + dd;

[want to display the text file here]

</script>
</body>
</html>

How do I display a text file named 'textfile'?

I have a text file for each day of the year. All of them are different. They're on the server in the same directory where the javascript is. When someone goes to the page I want the file corresponding to the date to be displayed.

1
  • Please provide more context. Where/what is this textfile you are talking about? Commented Dec 11, 2013 at 5:48

1 Answer 1

1

If the file is available in the server, then use

window.location.href = textfile; 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.