Click to See Complete Forum and Search --> : Trouble embedding javascript...


bchecca1
03-03-2003, 08:05 PM
Is there a special way that I must put a javascript in to an HTML document if I'm using FrontPage?

I've tried cut & paste under the HTML view, and it still comes up as if I was entering pure text.

Any ideas?

Thanks, Bruce C.

pyro
03-03-2003, 08:07 PM
Are you remember to your <script language="javascript" type="javascript"> and </script> tags in?

bchecca1
03-03-2003, 08:09 PM
Here's thew code I'm trying to paste in....

<script>
var before="the Bolton Landing Festival starts!”
var current="The festival starts today! It’s STILL not to late to come!"
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

function countdown(yr,m,d){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var futurestring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)
if (difference==0)
document.write(current)
else if (difference>0)
document.write("Only "+difference+" days until "+before)
}
//enter the count down date using the format year/month/day
countdown(2003,8,29)
</script>

pyro
03-03-2003, 08:21 PM
Ok, I think FrontPage has problems with this. Here is a workaround for you...

Paste the script into WordPad
Copy the script from WordPad
Paste the script into FrontPage

What happens is FrontPage turns the < into &lt; and the > into &gt; thus making your script appear on the page. For some reason, it does not do this when copying from WordPad... Don't ask me why.. :confused:

pyro
03-03-2003, 09:43 PM
Originally posted by Dave Clark
If the truth were to be knownI personally use Dreamweaver, so I didn't know the technicallity behind what caused the problem. It works fine to copy from anywhere into Dreamweaver, so I assumed it was a problem with FP, rather than Windows...

pyro
03-03-2003, 09:58 PM
...lol :D