Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

[Ask] How do I use the <body onload=” “> function on Magento? 
 
Korr
Sr. Member
 
Avatar
Total Posts:  116
Joined:  2008-05-05
Jakarta - Indonesia
 

Hi, all.

I’m trying to implement the following accordion script inside the CMS content.
->> http://www.dezinerfolio.com/2007/07/19/simple-javascript-accordions/

The script is quite simple and doesn’t need a framework (scriptaculous, etc..). So it’s dead easy to implement this baby.
...problem is, I can’t find a way to execute the <body onload=” ”> function; which is a necessary function for the script to run.

I’ve found that the column layout file under the ../app/design/..... (1 column, 2 columns, 3 columns, so on...) contain this functions.
But when I try to insert the code, it doesn’t seem to be working.

Anyone know the solution?

Thanks in advance.

 
Magento Community Magento Community
Magento Community
Magento Community
 
miked2004
Sr. Member
 
Avatar
Total Posts:  214
Joined:  2007-12-13
Atlanta, Georgia
 

Hey hope this helps.
I was not able to find any way to dynamicly add onload functions to the body tag. I needed to add some body onload and onunload events for Google maps, so I created a coppied the template file for the page I was working on. (in my case /template/page/1column.phtml) and renamed it to what ever you want to call it. Then in the layout xml file for the moduel I changed the tepmlate to use the one I just created. You can add the body load event to the new phtml file and that will only be used on the page that you set the template for.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top