/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] can someone check my javascript code

I’m having problems with JavaScript. I thought my computer was blocking JavaScript, but after checking I guess it is working. Can someone check this and tell me why the JavaScript isn’t working? The file was downloaded from a text book and I had to add the JavaScript code. Between the two horizontal rules there is suppose to be a welcome message displaying the current date and number of days left until the fair.

[code]
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml/DTD/xhtml1 transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title>Jefferson County Fair</title>

<style type=”text/css”>
<!–
body {
background-image: url(bkgrnd-jefferson.jpg);
}
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 24px;
color: #2C5198;
font-weight: bold;
}
.style3 { font-family: Arial, Helvetica, sans-serif; font-size: 24px; color: #C05600; font-weight: bold; }
–>
</style>
</head>
<body>
<p style=”margin-left:10%”>
<img src=”jeffersoncntylogo.gif” alt=”banner” width=”568″ height=”66″ />

<script type=”text/javascript”>
<!–Hide from old browsers
var today = new Date()
var dayofweek = today.toLocaleString()
dayLocate = dayofweek.indexOf(” “)
weekDay = dayofweek.substring(0, dayLocate)
newDay = dayofweek.substring(dayLocate)
dateLocate = newDay.indexOf(“,”)
monthDate = newDay.substring(0, dateLocate+1)
yearLocate = dayofweek.indexOf(“2008”)
year = dayofweek.substr(yearLocate, 4)

var fairDate = new Date (“August 17, 2008”)
var daysToGo = fairDate.getTime()-today.getTime()
var daysToFair = Math.ceil(daysToGo/1000*60*60*24))

document.write(“<h4 style=’margin-left:10%’ >Today is “+weekDay+” “+monthDate+” “+year+”. We “)
document.write(“have “+daysTofair+” days until the start of the fair on August 17, 2008!”)
document.write(“<br />See the finest in local crafts, arts, plants, and flowers, animals, and agricultural technology. “)
document.write(“Join us for rides, musical entertainment, and the best local cuisine.</h4>”)

//–>
</script>

</p>
<p style=”margin-left:10%”>
<img src=”dividerbrown.jpg” width=”575″ alt=”divider line” />
</p>
<p style=”margin-left:10%”>

</p>
<p style=”margin-left:10%”><img src=”dividerbrown.jpg” width=”575″ alt=”divider line” /></p>
<div style=”margin-left:10%”>
<table width=”66%” border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td width=”189″><div align=”left”><img src=”industry.jpg” alt=”industry” /></div></td>
<td><div align=”center”><img src=”farm.jpg” alt=”farm” /></div></td>
<td><div align=”left”><img src=”liesure.jpg” alt=”leisure” /></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width=”45%” align=”right”>
<div align=”center”><span class=”style3″>Industry</span></div>
</td>
<td width=”55%”>
<div align=”center” class=”style3″>Farming</div>
</td>
<td width=”55%”>
<div align=”center” class=”style3″>Leisure</div>
</td>
</tr>
<tr>
<td colspan=”3″>
<form name=”fairBooths” action=” “>
<br/>
<p align=”left”><b>Select an item from the list to get more information
about entry deadlines or setting up a booth:</b>
<select name=”Menu”>
<option value=”jeffersoncountyfair”>Select information item</option>
<option value=”vendors”>Vendor Guides</option>
<option value=”entries”>Entry Deadlines</option>
<option value=”booths”>Booth Reservations</option>
</select>
</p>
</form>
</td>
</tr>
</table>
</div>

</body>
</html>[/code]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FangDec 08.2009 — Remove extra closing bracketvar daysToFair = Math.ceil(daysToGo/1000*60*60*24)[COLOR="Red"])[/COLOR]Case is importantdocument.write("have "+daysTo[COLOR="Red"]f[/COLOR]air+" days until the start of the fair on August 17, 2008!")
Copy linkTweet thisAlerts:
@queenofjacks77authorDec 09.2009 — Thank you Fang!
×

Success!

Help @queenofjacks77 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...