473,385 Members | 1,372 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,385 software developers and data experts.

javascript audio player

tolkienarda
316 100+
hi all

my friend e-mailed me this quesion, i am more of a php person so i would appreciate it if you could help me look smart here is the quetsion
I am trying to write a simple script to play audio files for this guys
website and i need some help.

in the <head> if have:
Expand|Select|Wrap|Line Numbers
  1. /<script language="javascript">
  2. function player(source)
  3. {
  4. document.player.hidden(false);
  5. document.player.src(source);
  6. document.player.play(true);
  7. }
  8. </script>
  9.  
/In the <body> i have:
Expand|Select|Wrap|Line Numbers
  1. /<embed src="" loop=false name="player" controls=console hidden=true>
  2.  
/And then later:
Expand|Select|Wrap|Line Numbers
  1. /<a href="#top" onClick="player("audio/01.mp3")">Play</a>
  2.  
/It does nothing, like it doesn't even go into the function... Its been
so long since i have used javascript, its probably a simple problem. I
attached a copy of the html file. If you could take a look at it i would
appreciate it.


Ben
now i know that with the <a ...> tag that calls the javascript he could have just used the onclick, don't know why he didn't but i have changed that in another place but still it won't work.

thanks for any assistance

eirc
Feb 15 '07 #1
1 6045
Atli
5,058 Expert 4TB
Hi.

At first glance...
[HTML]<a href="#top" onClick="player("audio/01.mp3")">Play</a>[/HTML]

Double quote marks to open the onClick value, and then the double quotes in the function parameter will cause the value of onClick to be
"player(" and you would get a js error.

try
[HTML]<a href="#top" onClick="player('audio/01.mp3')">Play</a>[/HTML]
Feb 16 '07 #2

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

Similar topics

2
by: gsb | last post by:
I want to stream audio into a hidden frame and load, stop, and control volume via JavaScript. I'm thinking w/ Windows Media Player. Any thought as to how? Thanks, gsb
1
by: Ron Provost | last post by:
Hello, I'm developing a piece of software to assist illiteraate adults to learn to read. I'm trying to figure out how, if possible, to make audio playback asynchrnous but still controllable. ...
1
by: ray well | last post by:
hi, i'm looking for a .net audio player control, that can play wav, mp3, and some other common formats. i need to plays some audio in my app. i'm not looking for any whole audio studio, just...
1
by: richardscheff | last post by:
Video selector works for IE but not other browsers. for not IE <object ID='Player' data="video/dodgeball.wmv" type="video/x-ms-wmv" width="320" height="280"> <param name="filename"...
19
by: Tony | last post by:
I'm working on project that plays movies using Windows Media Player and I'm controlling everything with JavaScript. Per the client I only need to support IE 6 or greater which happens to make...
13
by: anil.rita | last post by:
When the user chooses an AV file to play, based upon the type of file, I want to use the default installed media player to play it. I am wondering if this is a good way - any alternatives,...
0
by: Terry Olsen | last post by:
If I have an audio file playing using DirectX.AudioVideoPlayback.Audio and I click the stop button, using the following code: Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As...
4
by: =?Utf-8?B?U2F0eWE=?= | last post by:
My PC crashed and I have installed windows XP SP2 again. Now audio is distored (it runs too fast) with all applications like Windows Media Player, Real Player, WIN DVD player, CD player. etc. What...
1
by: itsthefocusman | last post by:
Hi, My name is Daniel, and im using flash 8. Im building a flash site and wanted to include my audio on a page. I wanted to use a flash player such as http://odeo.com/audio/7932783/players or...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.