Will
29.07.2001, 17:55
Okay, this is the fourth board this topic is on, so I'm beginning to think my inability to figure it out isn't because I'm stupid. I know it isn't dhtml, though I figured with all the js demi-gods in here, it couldn't hurt to try! Here goes:
I am using a simple array to automatically rotate items through the page (pretty much the same as "Tip Of the Day" scripts). The array inserts its content by calling from another script which formats the layout while containing easily configured vars. The two scripts look like this (this is the example for movies):
<script language="JavaScript"><!--
/*Format Movie Layout Script
credits and comments here*/
function writemovie()
{
var describe = "Place description here"
var dvd_asin = "0000000000"
var vhs_asin = "0000000000"
var image = "images/thismovie.jpg"
url_begin = "http://www.amazon.com/exec/obidos/ASIN/"
amazon_id = "/my-id"
code="<center>" + image + "</center>
";
code+="<font face='Verdana' size=-1>";
code+=describe
code+="
<center>Review And Buy
";
code+="" + "[ DVD ] " + " ('" + url_begin + dvd_asin + amazon_id + "')";
code+="" + "[ VHS ]" + " ('" + url_begin + vhs_asin + amazon_id + "')";
code+="</font></center></p>";
return code;
}
// -->
</script>
<script language="JavaScript"><!--
/*Item Of The Day Script
credits and comments here*/
//Make new array and get the current day
var item = new Array();
Stamp = new Date();
today = Stamp.getDate();
item[0]=writemovie()
item[1]=writemovie()
item[2]=writemovie()
document.write(item[today-1]);
// -->
</script>
This script runs flawlessly, though to make it run a different movie every day, I would need to add 300 lines of code by repeating the Format Movie script 31 times. This is obviously unacceptable, especially when I'll need to run three or four of these scripts on the same page (movies, books, music etc).
Someone gave me this array and for the life of me I seem unable to include it:
var days=new Array("Here You have to put whatever you want","calls to functions, variables, or simply put in all the code for the html");
function writemovie(day)
{
document.write(days[day-1]);
}
var day=new Date;
day=getDate();
writemovie(day);
If anyone has some marvelous ideas, I'm all ears!
Thanks a bunch-- Will
I am using a simple array to automatically rotate items through the page (pretty much the same as "Tip Of the Day" scripts). The array inserts its content by calling from another script which formats the layout while containing easily configured vars. The two scripts look like this (this is the example for movies):
<script language="JavaScript"><!--
/*Format Movie Layout Script
credits and comments here*/
function writemovie()
{
var describe = "Place description here"
var dvd_asin = "0000000000"
var vhs_asin = "0000000000"
var image = "images/thismovie.jpg"
url_begin = "http://www.amazon.com/exec/obidos/ASIN/"
amazon_id = "/my-id"
code="<center>" + image + "</center>
";
code+="<font face='Verdana' size=-1>";
code+=describe
code+="
<center>Review And Buy
";
code+="" + "[ DVD ] " + " ('" + url_begin + dvd_asin + amazon_id + "')";
code+="" + "[ VHS ]" + " ('" + url_begin + vhs_asin + amazon_id + "')";
code+="</font></center></p>";
return code;
}
// -->
</script>
<script language="JavaScript"><!--
/*Item Of The Day Script
credits and comments here*/
//Make new array and get the current day
var item = new Array();
Stamp = new Date();
today = Stamp.getDate();
item[0]=writemovie()
item[1]=writemovie()
item[2]=writemovie()
document.write(item[today-1]);
// -->
</script>
This script runs flawlessly, though to make it run a different movie every day, I would need to add 300 lines of code by repeating the Format Movie script 31 times. This is obviously unacceptable, especially when I'll need to run three or four of these scripts on the same page (movies, books, music etc).
Someone gave me this array and for the life of me I seem unable to include it:
var days=new Array("Here You have to put whatever you want","calls to functions, variables, or simply put in all the code for the html");
function writemovie(day)
{
document.write(days[day-1]);
}
var day=new Date;
day=getDate();
writemovie(day);
If anyone has some marvelous ideas, I'm all ears!
Thanks a bunch-- Will