cloudy cloudy

Author Topic: asp NOAA warning script  (Read 1671 times)

0 Members and 1 Guest are viewing this topic.

Offline Freestyle

  • Posts: 87
asp NOAA warning script
« on: May 18, 2006, 05:37:37 AM »
I was tired of seeing "There are no active watches, warnings or advisories" on my site so I wrote a quick asp script to check to see if there are any warning and if not, dont display anything. This one is for a marquee scroller but you can use the basic code anywhere on your site you want to display NOAA warnings.
I'm still learning asp but I figured I share with any fellow asp users here...allthough it seems most use PHP...
Code: [Select]
<%
Set fso = CreateObject("Scripting.FileSystemObject") 
Set warning = fso.OpenTextFile(Server.MapPath("\") & "/noaawarningscrollraw.txt")
//Read the Contents of the noaawarningscrollraw.txt file
Scroller=warning.ReadAll
//remove any extra spaces
trim(Scroller)
//test to see if our file contains no warnings
if (Left(Scroller,1)) = "T" then
//cleanup if no warnings 
Set warning = Nothing 
Set fso = Nothing
Set Scroller = Nothing
else
//If warnings are present scroll them in a marquee 
Response.Write "<center><table border='1' cellpadding='0' cellspacing='0' width=550 bgcolor='#F0E68C'><tr><td> <font face='verdana,arial' size='1' color='#0000FF'>"
Response.Write "< <marquee> Your City and state here- <font size='1'><a href=""noaawarningscroll.html"">" & Scroller & " </marquee></font></a></td></tr></table></center> </a>" 
//cleanup
Set warning = Nothing 
Set fso = Nothing
Set Scroller = Nothing
end if
%>