473,414 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

onload music

I am trying to set up my website so that our jingle plays when you load the page, but as I am new to web development, I do not know how. I taught myself how to use Dreamweaver CS3, which means that I don't know all that much, escpecially about Javascript. Can anybody explain how to get music to play onload in terms that a newbie can understand?

Thanks,
Daniel
Jan 31 '08 #1
8 3879
Death Slaught
1,137 1GB
Here's a script I got 133 days ago from acoder :).

Expand|Select|Wrap|Line Numbers
  1. function play() {
  2. embed = document.createElement("embed");
  3. embed.setAttribute("src", "soundfile.wav");
  4. embed.setAttribute("hidden", true);
  5. embed.setAttribute("autostart", true);
  6. document.body.appendChild(embed);
  7. }
  8.  


Just change the part the says 'soundfile.wav' to source of your sound file. And just in case you don't know where to put JavaScript you could do it like this.


[HTML] <head>
<script type="text/javascript" src="script.js"></script>
</head>


<body onload="play()">
</body>
[/HTML]

And save the JavaScript in it's own file name 'script.js'.

^_^ Hope it helps, Thanks, Death
Jan 31 '08 #2
Death,

Thanks, I really appreciate it. I saw your thread, but I didn't really understand what I should do with it. You have cleared it up for me.

Thanks,
Daniel
Jan 31 '08 #3
I have a new problem, now. I put the script in my site, tested it in a couple of browsers, and it worked fine. Uploaded the new page to my site, and it doesn't work. Any ideas?

Thanks,
Daniel
Jan 31 '08 #4
acoder
16,027 Expert Mod 8TB
Post the page code. Have you linked to any script files that you forgot to upload?
Feb 1 '08 #5
Post the page code. Have you linked to any script files that you forgot to upload?
Thanks, I found it. Stupid mistake on my part. I appreciate it.

Daniel
Feb 1 '08 #6
acoder
16,027 Expert Mod 8TB
Glad to hear that you managed to fix it.
Feb 2 '08 #7
I am using this code and am having a problem with it. I use exactly what is posted earlier and can't get it to work in Firefox. Any ideas? Thanks
Feb 7 '08 #8
acoder
16,027 Expert Mod 8TB
I am using this code and am having a problem with it. I use exactly what is posted earlier and can't get it to work in Firefox. Any ideas? Thanks
Welcome to TSDN!

Do you get any errors? Post a test link if you have one available.
Feb 7 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Marian Aldenhövel | last post by:
Hi, I am trying to make pygame play music on windows. This simple program: import pygame,time pygame.init() print "Mixer settings", pygame.mixer.get_init() print "Mixer channels",...
1
by: Christine Forber | last post by:
I am looking for a way to open a given html page where I want, and not at the top of the page. This is for an intranet, not the www. I use a core application which takes templates containing...
20
by: gallery | last post by:
Our client insists on having a music loop playing as the visitor travels throughout his new HTML website. We will not be doing this in frames and I would prefer not to have the home page spawn...
2
by: Just Me | last post by:
If I use the shell32q.NameSpace(k) and the Parent property I can develop, for example, the path to My Music. Actually it ends with Desktop but Desktop can also be traced by using Parent to...
4
by: Doug van Vianen | last post by:
Hi, I am using Visual Basic 6 to generate web pages that can be used by the members of our seniors' computer club to create e-cards that include their own pictures. I wish to include background...
14
by: gnarl | last post by:
Hello all, I'm developing a site in PHP4 for a music artist, who wants music to play across all their pages. I have loaded a simple flash applet to play the music, but every time the visitor to...
2
by: FlashForumKB | last post by:
Here is a chance for you to make my developers look bad. I have hired these guys to development my website which, in part, has music demos available to my users. These demos must include the...
2
by: Suresh P | last post by:
Hi All, Is there any way other than frames to play music in the background of the website without restart while navigating to different pages of the website. Because, frames will affect the...
11
Death Slaught
by: Death Slaught | last post by:
I need a function that plays a song in the background ( in other words the user can't stop/start the music they have to go to another page or listen to it ) I'm not the greatest at JavaScript I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.