I have this code in JS
[code=javascript]
function show_player() {
document.mediap layer1.style.vi sibility = "visible";
}
function content(p, clip) {
var mus = document.getEle mentById('music ');
mus.style.visib ility = "visible";
mus.innerHTML = p;
var sound = [];
sound['ocean'] = "./Ocean_Breeze.mp 3";
sound['always'] = "http://www.youtube.com/v/K9MFBuzr6p4&rel =1";
sound['day'] = "http://www.youtube.com/v/Wxx_rO2oLPE&rel =1";
sound['mid'] = "http://www.youtube.com/v/4qQ4fpTBHwI&rel =1";
sound['erupt'] = "http://www.youtube.com/v/tqhz-i1WIQo&rel=1";
document.mediap layer1.src = sound[clip];
}
[/code]
with the following HTML to go with it.
[code=html]
<table align="center">
<tr>
<td colspan="1"><p style="visibili ty:hidden;" id="music">Ocea n Breeze</p></td>
</tr>
<tr>
<td colspan="1"><em bed type="applicati on/x-mplayer2" pluginspage="ht tp://www.microsoft.c om/Windows/MediaPlayer/" name="mediaplay er1" showstatusbar=" 1" id="mp" EnableContextMe nu="false" autostart="fals e" width="630" height="70" transparentstar t="1" loop="0" controller="tru e" src="" style="visibili ty:hidden;"></embed></td>
</tr>
</table>
</td></tr></table>
<br><br><br>
<table align="center">
<tr>
<td align="center" colspan="1"><p> Which song would you like to hear?</p></td></tr>
<tr>
<td>
<a href="#" onclick="javasc ript:show_playe r();content('Oc ean Breeze','ocean' );"> Ocean Breeze</a>
</td>
<td>|</td>
</tr>
<tr>
<td>
<a href="#" onclick="javasc ript:show_playe r();content('Al ways with me, always with you','always'); ">Always With Me, Always With You</a>
</td>
<td>|</td>
</tr>
<tr>
<td>
<a href="#" onclick="javasc ript:show_playe r();content('Da y at the Beach','day');" >Day Of The Beach</a>
</td>
<td>|</td>
</tr>
<tr>
<td>
<a href="#" onclick="javasc ript:show_playe r();content('Mi dnight','mid'); ">Midnight</a>
</td>
<td>|</td>
</tr>
<tr>
<td>
<a href="#" onclick="javasc ript:show_playe r();content('Er uption', 'erupt');">Erup tion</a>
</td>
<td>|</td>
</tr>
</table>
[/code]
When I click the links the player appears, so the visibility part works, also the innerHTML of the <p> element works on each, but the content doesn't change, is there something I'm doing wrong?
Sam
[code=javascript]
function show_player() {
document.mediap layer1.style.vi sibility = "visible";
}
function content(p, clip) {
var mus = document.getEle mentById('music ');
mus.style.visib ility = "visible";
mus.innerHTML = p;
var sound = [];
sound['ocean'] = "./Ocean_Breeze.mp 3";
sound['always'] = "http://www.youtube.com/v/K9MFBuzr6p4&rel =1";
sound['day'] = "http://www.youtube.com/v/Wxx_rO2oLPE&rel =1";
sound['mid'] = "http://www.youtube.com/v/4qQ4fpTBHwI&rel =1";
sound['erupt'] = "http://www.youtube.com/v/tqhz-i1WIQo&rel=1";
document.mediap layer1.src = sound[clip];
}
[/code]
with the following HTML to go with it.
[code=html]
<table align="center">
<tr>
<td colspan="1"><p style="visibili ty:hidden;" id="music">Ocea n Breeze</p></td>
</tr>
<tr>
<td colspan="1"><em bed type="applicati on/x-mplayer2" pluginspage="ht tp://www.microsoft.c om/Windows/MediaPlayer/" name="mediaplay er1" showstatusbar=" 1" id="mp" EnableContextMe nu="false" autostart="fals e" width="630" height="70" transparentstar t="1" loop="0" controller="tru e" src="" style="visibili ty:hidden;"></embed></td>
</tr>
</table>
</td></tr></table>
<br><br><br>
<table align="center">
<tr>
<td align="center" colspan="1"><p> Which song would you like to hear?</p></td></tr>
<tr>
<td>
<a href="#" onclick="javasc ript:show_playe r();content('Oc ean Breeze','ocean' );"> Ocean Breeze</a>
</td>
<td>|</td>
</tr>
<tr>
<td>
<a href="#" onclick="javasc ript:show_playe r();content('Al ways with me, always with you','always'); ">Always With Me, Always With You</a>
</td>
<td>|</td>
</tr>
<tr>
<td>
<a href="#" onclick="javasc ript:show_playe r();content('Da y at the Beach','day');" >Day Of The Beach</a>
</td>
<td>|</td>
</tr>
<tr>
<td>
<a href="#" onclick="javasc ript:show_playe r();content('Mi dnight','mid'); ">Midnight</a>
</td>
<td>|</td>
</tr>
<tr>
<td>
<a href="#" onclick="javasc ript:show_playe r();content('Er uption', 'erupt');">Erup tion</a>
</td>
<td>|</td>
</tr>
</table>
[/code]
When I click the links the player appears, so the visibility part works, also the innerHTML of the <p> element works on each, but the content doesn't change, is there something I'm doing wrong?
Sam
Comment