The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Script Problem! Generator messing up Home Page.

View previous topic View next topic Go down

Script Problem! Generator messing up Home Page.

Post by Chris Hickingbottom on September 30th 2010, 9:13 pm

Ok, so when I put my weather generator for a roleplay section of my site up a couple days ago, it worked just fine. Now it is messing up the home page by blending everything together.. and the second weather part is not showing up. Any suggestions??

Code:
<br><script type="text/javascript">
/* Weather Generator */
var d=new Date();
var class1='titlebg'; //the class for the top row of cells
var class2='catbg';//the class for the city name cells
var class3='windowbg'; // the class for the other cells
var ans ='day'; //write week for weekly, day for daily
//note: it is case sensitive
if(ans=='day'){
var week = Math.round(d.getTime()/(1000*60*60*24));
}
else{
var week = Math.round(d.getTime()/(1000*60*60*24*7));
}
var weather=[
['Sunny','http://i732.photobucket.com/albums/ww329/Chrishick/SunnyIcon.jpg','Sunny. Great day outside today!'], //0
['Mostly Sunny','http://i732.photobucket.com/albums/ww329/Chrishick/MostlySunnyIcon.jpg','Mostly Sunny'], //1
['Partly Cloudy','http://i732.photobucket.com/albums/ww329/Chrishick/fall.jpg','Partly Cloudy'], //2
['Cloudy','http://i732.photobucket.com/albums/ww329/Chrishick/CloudyIcon.jpg','Its cloudy today. The sun just does not want to come out.'], //3
['Light Rain','http://i732.photobucket.com/albums/ww329/Chrishick/LightRainIcon.jpg','Its only lightly raining today. Much like a drizzle; it is quite peaceful.'], //4
['Rainy','http://i732.photobucket.com/albums/ww329/Chrishick/RainIcon-1.jpg','Its definitely wet outside. A great day for the crops.'], //5
['Heavy Rain','http://i732.photobucket.com/albums/ww329/Chrishick/HeavyRainIcon.jpg','It will be pouring outside today. You might want to stay inside.'], //6
['Thunderstorm','http://i732.photobucket.com/albums/ww329/Chrishick/ThunderstormsIcon.jpg','Its bad outside. The wind is blowing hard and the rain is coming down even harder. Thunder and lightning come along with this.'], //7
['Windy','http://i732.photobucket.com/albums/ww329/Chrishick/WindyIcon.jpg','Its sunny outside, but really windy.'], //8
['Icy Rain','http://i732.photobucket.com/albums/ww329/Chrishick/IcyRainIcon.jpg','Its very cold outside and to top it all off, its raining.'], //9
['Clear Night','http://i732.photobucket.com/albums/ww329/Chrishick/MoonIcon.jpg','The night is clear. the moon is definitely visible, depending on its phase.'], //10
['Few clouds at night','http://i732.photobucket.com/albums/ww329/Chrishick/NightFewCloudsIcon.jpg','The night is just a little cloudy. You can still see the moon, depending on its phase.'], //11
['Mostly Cloudy Night','http://i732.photobucket.com/albums/ww329/Chrishick/NightMostlyCloudyIcon.jpg','The night sky is covered with the clouds. The moon is not going to be visible in any phase.'], //12
['Night Rain','http://i732.photobucket.com/albums/ww329/Chrishick/NightRainIcon.jpg','Its raining tonight. If you are inside a building, it is quite relaxing to hear the beat of it upon the roof.'], //13
['Heavy Rain Night','http://i732.photobucket.com/albums/ww329/Chrishick/HeavyRainatNightIcon.jpg','Its pouring down outside tonight. You can barely see in-front-of yourself.'], //14
['Night Thunderstorm','http,://i732.photobucket.com/albums/ww329/Chrishick/NightThunderstormsIcon.jpg','Its storming outside tonight. The wind is blowing hard and the lightning and thunder are not too friendly.'] //15
];i
var cities=[
['Interminable World-Fall-Daytime',60,81,0,15,1,15,2,15,3,15,4,8,5,8,6,8,7,8,8,8],
['Interminable World-Fall-Nightime',35,61,10,20,11,20,12,20,13,13,14,13,15,13]
];
var f=new Array();
function PickTemperature(x){
for(m=0;m<(cities[x][2]-cities[x][1]);m++){
if((week*week)%(cities[x][2]-cities[x][1])==m){
document.write(cities[x][1]+m + 'F or ');
document.write(Math.round((cities[x][1]+m-32)*(5/9)) + 'C');
}}}
///////////
for(i=0;i<cities.length;i++){
for(p=0;p<=cities[i].length;p++){
if(p==0){
f[i]=0;
}
else if(p!=0 & p!=2 & p%2==0){
f[i]+=cities[i][p];
}}}
function PickWeather(x){
document.write('</td><td ="'+class3+'" align="center"> <img src="');
for(m=0;m<f[x];m++){
if((week*week)%f[x]==m){
var z=2,L=0;
while(L<m){
z+=2;
L+=cities[x][z];
}
document.write(weather[cities[x][z-1]][1] + '" />');
document.write(' </td><td class="windowbg" align="center"> ' + weather[cities[x][z-1]][2] + ' </td></tr>');
}}}
document.write('<table width="670"><tr><td class="'+class1+'" align="center"><h2>Region-Season-Time</h2></td><td class="'+class1+'" align="center"><h2>Temperature</h2></td><td class="'+class1+'" align="center"><h2>Weather</h2></td><td class="'+class1+'" align="center"><h2>Weather Statistics</h2></td></tr>');
for(i=0;i<cities.length;i++){
document.write('<tr><td ="'+class2+'" height="30px" align="center">');
document.write(cities[i][0]);
document.write('</td><td class="'+class3+'" height="30px" align="center"> ');
PickTemperature(i);
PickWeather(i);
}
document.write('</table>');
</script></br>

Chris Hickingbottom
Forumember

Posts : 25
Reputation : 0
Language : English

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum