473,806 Members | 2,582 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help Please!

I don't know anything about Javascript, but a little about standard HTML.

I have created a website and have set the homepage to automatically play a
sound file on opening.

What I would like is for a random sound file (from my "audio" directory) to
be played instead of the same one each time you visit.

Can this be done and if so can someone please supply me with the (or an
example) of code?.........
Jul 20 '05 #1
3 1492
Ivo
"Franklin P Patchey" <RE************ **@talk21.com> wrote in message
news:bl******** *@newsg1.svr.po l.co.uk...
I don't know anything about Javascript, but a little about standard HTML.

I have created a website and have set the homepage to automatically play a
sound file on opening.

What I would like is for a random sound file (from my "audio" directory) to be played instead of the same one each time you visit.

Can this be done and if so can someone please supply me with the (or an
example) of code?.........


Please use descriptive subject lines.
Yes, it can be done. One way would be to put the names of the files in an
array, use Math.random()* the length of the array to randomly select a file,
and document.write or manipulate the DOM to embed it.
To find out more about what an array is etc., read this newsgroup, the
multitude of websites about javascript and ask Google. The more you tell us
about what you have tried, the more specific our help can be.
HTH
Ivo
Jul 20 '05 #2
Ivo
"Franklin P Patchey" <RE************ **@talk21.com> wrote in message
news:bl******** *@newsg1.svr.po l.co.uk...
I don't know anything about Javascript, but a little about standard HTML.

I have created a website and have set the homepage to automatically play a
sound file on opening.

What I would like is for a random sound file (from my "audio" directory) to be played instead of the same one each time you visit.

Can this be done and if so can someone please supply me with the (or an
example) of code?.........


Please use descriptive subject lines.
Yes, it can be done. One way would be to put the names of the files in an
array, use Math.random()* the length of the array to randomly select a file,
and document.write or manipulate the DOM to embed it.
To find out more about what an array is etc., read this newsgroup, the
multitude of websites about javascript and ask Google. The more you tell us
about what you have tried, the more specific our help can be.
HTH
Ivo

Jul 20 '05 #3
JRS: In article <bl*********@ne wsg1.svr.pol.co .uk>, seen in
news:comp.lang. javascript, Franklin P Patchey
<RE************ **@talk21.com> posted at Sun, 28 Sep 2003 23:57:41 :-
I don't know anything about Javascript, but a little about standard HTML.

I have created a website and have set the homepage to automatically play a
sound file on opening.


That will not work on systems which, like mine, have sound switched off.
It will also annoy those who were expecting to be able to brows the web
in peace and quiet, or while listening to their own choice of music.

Sound should only be played when the potential hearer actually wants it.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3273
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old scripts working on a new server with the most recent version of PHP. I've pretty much taken care of all the various errors that were popping up. Most only pointed out out non-fatal undefined or assumed variables. I've been able to cure most of...
1
1957
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the past 2 weeks now i give up and call for help. Please if anyone can gide me through i will be so grateful!! I have pasted my code below
0
1705
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web browser that Hotmail does not support. If you continue to use your current browser software we cannot guarantee that Hotmail will work correctly for you". Please help, this is very annoying. I have been searching for help on
12
2141
by: Christo | last post by:
borland c++ 5.01 character constant must be one or two characters long get this when compiling my first c++ program can anyone out there help? it is highlighting this line as the problem cout << "Please Enter First number: ";
7
3627
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title> </head> <style type="text/css">
5
3008
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig <<<<<<<<<<<<<<CODE>>>>>>>>>>>>>>>> <html>
17
2039
by: JT | last post by:
Help me the following C++ question: Write a program to help a local bookshop automate its billing system. The program should do the following: (a)Let the user enter the ISBN, the system will trace the title and price of the book automatically. The system should check whether the book is in the stock or not. If it is not, please let the user to enter again. (b)Allow a customer to buy more than one item from the bookshop.
7
3301
by: tyler_durden | last post by:
thanks a lot for all your help..I'm really appreciated... with all the help I've been getting in forums I've been able to continue my program and it's almost done, but I'm having a big problem that I believe if it's solved, the remaining stuff is easy... my full program until now is here: http://www.geocities.com/tom4_h4wk/progmail.zip the problem is the segmentation fault when main trys to run leficheiro.c.... the *.c2 files are the...
23
3296
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application to create certain textboxes, labels, and combo boxes? Any ideas would be appreciated. Thanks
2
1547
by: =?Utf-8?B?U2NvdHRSYWREZXY=?= | last post by:
I'm creating a doc project for my c# program. I've done this before but this time sonething is wrong. I build my doc project and is succeeds but when I open the help file, there is no documentation there. I enabled XML documentation file under build properties and have recompiled my program but still I have nothing. What am I doing wrong? -- -ScottRadDev
0
10620
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10369
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10372
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5682
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.