Dynadot Black Friday and Cyber Monday 2026: save more on domains. See our sales.

Help me with Java

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
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
Close
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
Close
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
Close
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
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

New: watch any domain
You can now watch domains on NamePros. We check each one and notify you when something changes. Search for a domain and press Watch on...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back