Posts Tagged ‘Start Music Player on loading page’

Multiple onLoad Events

Thursday, January 21st, 2010

I located some information about multiple onLoad events for javascripts with a web search. The music player that I have used on several sites came set up with an onClick event to start the player. The comment system uses an onLoad event in the body tag to initialize the comment script.

When I set up the AudioArt MusicPlayer site I had wanted the music player to start through a link but had to have a second play button on the landing page from the link that still had to be clicked. I became aware of the possibility of using the onLoad event in the place of the onClick event to start the player. I adapted the code and tried it out, and it worked. I also wanted the comment system on this landing page to take specific comments on the music.

I did the web search and found the information about the formatting for multiple onLoad events, so I tried that out. It does work. The player loads and begins to play when the page is opened. The comment system will accept input and function properly as well. The only problem with the solution is that the page reloads if there is a comment posted and that restarts the player. I will just add a note that explains the situation. There may be a better solution but this is workable. Only a small percentage of people will leave a comment anyway, so it should not be too much of a problem.

I do need to make a few more pages for this site and I have a bit of other housekeeping to take care of with this update. The major technical hurdle is behind me, so the rest of the update is downhill. The new features are now active so you can check them out at The AudioArt MusicPlayer Site.


privacy policy | terms of service | about us