I am trying to add javascript to a page that needs to be activated when the page loads. However I can't just add my own body tag as there is already one created by the program. Any idea how I can add my onload request to my page?
Thanks
Mark
Adding Javascript
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Adding Javascript
You could try putting it into the HTML Head field if it is for a particular category or product- I don't know if this will work or not.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Adding Javascript
For each function you want to call when the page loads, put this inside the HTML head tag:
Or, ideally, this would be contained in an external js file you reference in the head tag.
Code: Select all
<head>
window.onload = function() {
yourFirstFunction();
yourSectionFunction();
}
</head>
Re: Adding Javascript
Thanks for your help. It didn't work when I added it to the header of a content scriplet though. It just seems to ignore any scripting that I put in that box. I moved the script down into the body and it works now. I know that isn't the best of coding practices but it seems to be the only way I could get around it.
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Adding Javascript
Location of script- I've read a couple of things lately that mention putting the javascript at the bottom to help page performance. That way the content loads, even though the javascript might be slow.
http://www.stevesouders.com-- He is chief performance at Yahoo! and wrote a book "High Performance Web Sites"
http://www.stevesouders.com-- He is chief performance at Yahoo! and wrote a book "High Performance Web Sites"
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx