Having trouble linking .js script in customizations
aciurczak
Registered Users Posts: 16 Big grins
I have a simple array that I use for my header. It works fine if I cut and past the whole large script with function in. On my other sites it works fine if I link to the script and use a src= field.
But on the javascript section of the smugmug site, it closes the tag with a > before the src=, so it does not work.
In other words, all I am putting in the box is this:
smugmug then inserts it in the page like this:
and since there is a > after the type, it doesn't load the src. Any suggestions?
But on the javascript section of the smugmug site, it closes the tag with a > before the src=, so it does not work.
In other words, all I am putting in the box is this:
src="http://www.montgomerybikers.com/forums/clientscript/picturearray.js"
smugmug then inserts it in the page like this:
<script language="javascript" type="text/javascript"> src="http://www.montgomerybikers.com/forums/clientscript/picturearray.js" </script>
and since there is a > after the type, it doesn't load the src. Any suggestions?
0
Comments
And put this in your 'JavaScript HTML>' field of your customization page!
When I hear the earth will melt into the sun,
in two billion years,
all I can think is:
"Will that be on a Monday?"
==========================
http://www.streetsofboston.com
http://blog.antonspaans.com
I think that's exactly the point. I want it to be what you (and I) posted, but it isn't going to happen, as smugmug inserts this phrase, with the closing > before it inserts any code that you put in the text box:
<img src="https://us.v-cdn.net/6029383/emoji/ne_nau.gif" border="0" alt="" >
ninjette.org
cal24.com
When I hear the earth will melt into the sun,
in two billion years,
all I can think is:
"Will that be on a Monday?"
==========================
http://www.streetsofboston.com
http://blog.antonspaans.com
NO NO NO NO NO
The body tag of the customization field is for only one thing ... the BODY tag! Nothing else should ever go in there. Right now we parse and add things to the body tag, like extra classes and onload javascripts, so if there is not a body tag to do that to, things will break (and badly).
The correct spot to put linked javascripts is in the header or footer area of the site; just add in this:
<script language="javascript" type="text/javascript" src="http://www.montgomerybikers.com/forums/clientscript/picturearray.js"></script> Along with any other code you have for the header or footer.
I meant the 'JavaScript HTML>' field!! That's where i have the script inclusions. Sorry again!
Thanks for pointing it out, JT!<img src="https://us.v-cdn.net/6029383/emoji/thumb.gif" border="0" alt="" >
When I hear the earth will melt into the sun,
in two billion years,
all I can think is:
"Will that be on a Monday?"
==========================
http://www.streetsofboston.com
http://blog.antonspaans.com
I put the original code right at the top of the header, and it worked like a charm. I thought I needed to put it within the "javascript" section, but as we're putting the script tags in anyway, I guess that's not necessary. Thanks for both of your help!
Site is at: http://www.smugmug.com/community/MSMC if you want to see the working code. Thanks again!
ninjette.org
cal24.com