View Full Version : java script Mediya player control error

04-30-2009, 05:57 PM
When I going to Change mediya player URL and reload media player through Java script. First time it plays well and, when I change Drop down and select new url to reload mediia player, It plays New URL and also it plays former url too. When I select NEW url 3 times. Mediya player will play both 3 Urls.

How do I fix it. I want to play only URL which I select from Drop down box. Help me to solve this matter.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

<div id="divcont" style="position:absolute; left:8px; top:215px; width:816px; height:239px; z-index:1"></div>
<form name="form1" method="post" action="">
<select name="select" onChange="javascript:a();">
<option value="http://url 1" selected>URL1</option>
<option value="http://url 2">URL1</option>
<script language="JavaScript" type="text/JavaScript">
function a()
var url = document.getElementById('select').value;

mplpar = '<object id="MediaPlayer" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">';
mplpar += ' <param name="FileName" value="' + url +'">';
mplpar += ' <param name="AnimationatStart" value="false">';
mplpar += ' <param name="TransparentatStart" value="true">';
mplpar += ' <param name="AutoStart" value="true">';
mplpar += ' <param name="ShowControls" value="TRUE">';
mplpar += ' <embed id="MediaPlayer" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&" src="' + url +'" name="MediaPlayer" showcontrols="TRUE" width="320" height="285"></embed>';
mplpar += '</object>';

document.getElementById('divcont').innerHTML = mplpar;