[Javascript] Javascript include problem?

Jason Pruim lists at pruimphotography.com
Sat Oct 2 09:17:06 CDT 2010


On Oct 1, 2010, at 10:14 PM, John List wrote:

> 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

Hi John,

I did as you suggested, split off just the javascript into it's  
own .js file and tried including it both ways (IE: <script  
src="blahblahblah"></script > and a php include)

Neither worked... had the same result... I'm wondering if something  
with the include is messing it up? Should I just try and put the whole  
thing in a <script> </script> in the head of the file? Not the most  
portable but if it would work...

THanks again for your help John!


>
>
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript



More information about the Javascript mailing list