DoLordBoy
06-12-2004, 10:51 PM
Okay, I'm trying to make a page that functions as a top navbar, which allows you to play music by clicking a link. When you click the link, an embedded song will play and the name of the song will appear in the "Now Playing:" section. The "Now Playing:" part works, but it doesn't seem to want to play the embedded song.
The variables are: songfilename (name of the mp3. in the Music folder), songname (Title of the song which will be displayed), artist (Artist name which will be displayed), artistwebsite (website of the artist). Since all but the first one work fine, please try to follow the part about playing an embedded song and tell me where I went wrong. (I highlighted the parts about embedding in red). Thanks in advance!
<html>
<head>
<title></title>
<script type="text/javascript">
function startMusic(songfilename, songname, artist, artistwebsite)
{
document.getElementById('embMusic').src='Music/' + songfilename;
document.getElementById('NOWPLAYING').innerHTML='Now Playing: <font color=red><b>' + songname + '</b></font> by <a href=' + artistwebsite + ' target=_display class=ARTIST>' + artist + '</a>'
}
function stopMusic()
{
document.getElementById('embMusic').src='';
document.getElementById('NOWPLAYING').innerHTML='Now Playing:'
}
</script>
</head>
<body>
<h2>
Music:
 
<a href="javascript:startMusic('You_Alone.mp3','You Alone','Something Like Silas','http://www.somethinglikesilas.com')">
You Alone
</a>
 
<a href="javascript:startMusic('Better_Is_One_Day.mp3','Better Is One Day','Something Like Silas','http://www.somethinglikesilas.com')">
Better is One Day
</a>
 
<a href="javascript:startMusic('Reach_Me.mp3','Reach Me','MercyFlood','http://www.Mercyflood.com')">
Reach Me
</a>
<a href="javascript:startMusic('Welcome_Home.mp3','Welcome Home','MercyFlood','http://www.Mercyflood.com')"> 
Welcome Home
</a>
 
<a href="javascript:startMusic('You_Are.mp3','You Are','MercyFlood','http://www.Mercyflood.com')">
You Are
</a>
 
<a href="javascript:stopMusic()">
No Music
</a>
</h2>
<h3>
<DIV ID="NOWPLAYING" align=bottom>Now Playing: </DIV><DIV ID="WEBSITE" align=right></DIV>
</h3><hr>
<br><br><br><Br>
<embed src="" autostart="true" hidden="true" Id="embMusic">
<br>
</html>
The variables are: songfilename (name of the mp3. in the Music folder), songname (Title of the song which will be displayed), artist (Artist name which will be displayed), artistwebsite (website of the artist). Since all but the first one work fine, please try to follow the part about playing an embedded song and tell me where I went wrong. (I highlighted the parts about embedding in red). Thanks in advance!
<html>
<head>
<title></title>
<script type="text/javascript">
function startMusic(songfilename, songname, artist, artistwebsite)
{
document.getElementById('embMusic').src='Music/' + songfilename;
document.getElementById('NOWPLAYING').innerHTML='Now Playing: <font color=red><b>' + songname + '</b></font> by <a href=' + artistwebsite + ' target=_display class=ARTIST>' + artist + '</a>'
}
function stopMusic()
{
document.getElementById('embMusic').src='';
document.getElementById('NOWPLAYING').innerHTML='Now Playing:'
}
</script>
</head>
<body>
<h2>
Music:
 
<a href="javascript:startMusic('You_Alone.mp3','You Alone','Something Like Silas','http://www.somethinglikesilas.com')">
You Alone
</a>
 
<a href="javascript:startMusic('Better_Is_One_Day.mp3','Better Is One Day','Something Like Silas','http://www.somethinglikesilas.com')">
Better is One Day
</a>
 
<a href="javascript:startMusic('Reach_Me.mp3','Reach Me','MercyFlood','http://www.Mercyflood.com')">
Reach Me
</a>
<a href="javascript:startMusic('Welcome_Home.mp3','Welcome Home','MercyFlood','http://www.Mercyflood.com')"> 
Welcome Home
</a>
 
<a href="javascript:startMusic('You_Are.mp3','You Are','MercyFlood','http://www.Mercyflood.com')">
You Are
</a>
 
<a href="javascript:stopMusic()">
No Music
</a>
</h2>
<h3>
<DIV ID="NOWPLAYING" align=bottom>Now Playing: </DIV><DIV ID="WEBSITE" align=right></DIV>
</h3><hr>
<br><br><br><Br>
<embed src="" autostart="true" hidden="true" Id="embMusic">
<br>
</html>