[Javascript] Javascript include problem?

John List johnlist at gulfbridge.net
Fri Oct 1 21:14:26 CDT 2010


On 10/01/2010 09:47 PM, Jason Pruim wrote:
> Hey Everyone,
>
> I just signed up for the list and I can't wait to get really deep into 
> javascript and be able to make amazing things happen.
>
> But right now I'm running into a small problem...
>
> I have a javascript page that I am including in a combination php/html 
> page. (Yes I'm going for everything! :)) and the javascript works just 
> fine if I load the page independently but when I try and view it via 
> an include it won't display the map...
>
> Link for the stand alone page: 
> HTTP://jason.pruimphotography.com/dev/cms2/includes/google/testmap.html
>
> Link for included page: 
> HTTP://jason.pruimphotography.com/dev/cms2/events/display1.php?id=46
>
> Any idea what the problem is? :)
> Thanks in advance for any help or pointers you can give! :) 

Jason, it looks like your "javascript page" is a complete html page, not 
just javascript. You are including that in another html page, so you 
wind up with multiple <html>, <head>, and <body> tags.

Put your javascript only (no html) in its own .js file, and reference 
that file in a <script src= > tag in the head of the main page. (Or, if 
you prefer, use php to include it between  <script></script> tags in the 
head of the page.)

Hope that helps,

John




More information about the Javascript mailing list