...

View Full Version : Conflicting script



rogerskf
09-25-2008, 03:00 PM
Can someone please tell me why this script is not working?

<script language="JavaScript">
<!-- hide from old browsers
var event = "V.P. debate in MO" // NAME OF EVENT GOES HERE
var eventdate = "10/02/2008" // DATE OF EVENT GOES HERE
var today = new Date()
var targetDate = new Date(eventdate)
var timeBeforeTarget = Math.floor(( targetDate.getTime()
- today.getTime()) / 86400000)
var msg = (timeBeforeTarget +1)
document.write("<li style=\"list-style-type: none\">",event,": <b><a
title=\"",eventdate,"\" id=\"date\">",msg," days</b></a></li>")
//-->
</script>

Kor
09-25-2008, 03:48 PM
Can someone please tell me why this script is not working?

<script language="JavaScript">
<!-- hide from old browsers
var event = "V.P. debate in MO" // NAME OF EVENT GOES HERE
var eventdate = "10/02/2008" // DATE OF EVENT GOES HERE
var today = new Date()
var targetDate = new Date(eventdate)
var timeBeforeTarget = Math.floor(( targetDate.getTime()
- today.getTime()) / 86400000)
var msg = (timeBeforeTarget +1)
document.write("<li style=\"list-style-type: none\">",event,": <b><a /*here's a break line*/
title=\"",eventdate,"\" id=\"date\">",msg," days</b></a></li>")
//-->
</script>
You should not break the document.write() line


document.write("<li style=\"list-style-type: none\">",event,": <b><a title=\"",eventdate,"\" id=\"date\">",msg," days</b></a></li>")


And you'd better not use event as a variable. event is a javascript reserved word. Name the variable otherwise: ev, or eve...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum