Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Javascript from document.writeln

Status
Not open for further replies.

nochoice

Programmer
Jun 17, 2003
72
0
0
CA
Hi Everybody,

I'm having a bit of trouble explaining what I'm trying to do, so please bear with me.

I have a website with the following code:

<html>
<head>
<title>Frosh Galleries</title>
</head>

<body>

<script language=&quot;JavaScript1.2&quot; src=&quot;</script>
<script language=&quot;JavaScript1.2&quot;>display();</script>

</body>

</html>


As you can see this is very basic.

Galleries.js looks like this:

function display(){

var currdate = new Date()
var day = currdate.getDay()
var date = currdate.getDate()
var month = currdate.getMonth()
var year = currdate.getYear()
month++
if (date < 10) {
date = ('0'+date);
}

if (month < 10) {
month = ('0'+month);
}

opendate= (date+''+month+''+year);

document.writeln (opendate);

}

Again, Very Simple.

What I would like to do is 'document.writeln' the following statements and have the statements execute.

<script language=&quot;JavaScript1.2&quot; src=&quot;opendate&quot;>
</script>
<script language=&quot;JavaScript1.2&quot;>display();</script>

Note: opendate is a variable

I think I found this a while back in this forum, but I came up empty this time when I search. If you could point me in the right direction or offer any help that would be great.

Thanks in adavnce,
NoChoice
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top