Dynadot โ€” .com Transfer

Help me with Java

SpaceshipSpaceship
Watch

abcde

Established Member
Impact
16
PHP:
<script> 
function play_live(link){ 
//ram + rm
if ((link.indexOf(".ram") != -1) || (link.indexOf(".rm") != -1)){ 
my_player.innerHTML = '<embed src="' + link + '"type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1" CONTROLS="ControlPanel" CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT="40" WIDTH="280" AUTOSTART="1" volume="50" /><br />'; 
}
// video 
if ((link.indexOf(".wmv") != -1) || (link.indexOf(".avi") != -1)){ 
my_player.innerHTML = '<embed src="' + link + '"type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" name="media_player" showcontrols="1" showdisplay="0" showstatusbar="1" enablecontextmenu="1" autostart="1" volume="50" /><br />'; 
} 
// audio 
else { 
my_player.innerHTML = '<embed src="' + link + '"type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" name="media_player" showcontrols="1" showdisplay="0" showstatusbar="1" enablecontextmenu="1" width="280" height="69" autostart="1" volume="50" /><br />'; 
} 
} 
</script>



The code seems fine accept for the code play .ram and .rm below. Could anyone please help me fix it?



PHP:
function play_live(link){  
//ram + rm 

if ((link.indexOf(".ram") != -1) || (link.indexOf(".rm") != -1)){  
my_player.innerHTML = '<embed src="' + link + '"type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1" CONTROLS="ControlPanel" CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT="40" WIDTH="280" AUTOSTART="1" volume="50" /><br />';  
}
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
I think your video if statement should be "else if".
 
0
•••
For the record, this is Javascript, not Java.

And the only way somebody is going to be able to help you is if you tell us what the error is. We need some way to reproduce it.

And yes, consider using "else if" to switch off between one of those three statements. Right now, two of them may be evaluated, whereas if you made the second "if" an "else if" only one would be evaluated.
 
0
•••
solved: Thanks guys!
PHP:
<script> 
function play_live(link){ 

// video 
if ((link.indexOf(".wmv") != -1) || (link.indexOf(".avi") != -1)){ 
my_player.innerHTML = '<embed src="' + link + '"type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" name="media_player" showcontrols="1" showdisplay="0" showstatusbar="1" enablecontextmenu="1" autostart="1" volume="50" /><br />'; 
}
//ram + rm
else if ((link.indexOf(".rm") != -1) || (link.indexOf(".ram") != -1)){ 
my_player.innerHTML = '<embed src="' + link + '"type="audio/x-pn-realaudio-plugin" pluginspage="http://www.real.com/player/index.html?src=000629realhome" width="280" height="36" controls="ControlPanel" console="video" autostart="true" /><br />'; 
} 
// audio 
else { 
my_player.innerHTML = '<embed src="' + link + '"type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" name="media_player" showcontrols="1" showdisplay="0" showstatusbar="1" enablecontextmenu="1" width="280" height="69" autostart="1" volume="50" /><br />'; 
} 
}
</script>
 
0
•••
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
NameMaxi - Your Domain Has Buyers
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back