Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code not working in mozilla

Status
Not open for further replies.

taika

IS-IT--Management
Joined
Mar 22, 2006
Messages
2
Location
LT
Hello,
i have a code that doesn't work in mozilla but works in IE, could someone find what is wrong with it?
Thank you

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=windows-1252">
<script language=JavaScript>
var tStart = null;
function UpdateTimer() {
if(!tStart)
{
tStart = new Date();
document.MediaPlayer.play();
}
var tDate = new Date();
var tDiff = tDate.getTime() - tStart.getTime();

if (tDiff > 0)
{
document.MediaPlayer.stop();
return;
}

timerID = setTimeout("UpdateTimer()", 1);
}
</script>
</head>

<body onload="UpdateTimer()">
<OBJECT ID="MediaPlayer"
WIDTH="160" HEIGHT="130"
CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="_a.wmv">
<PARAM NAME="autostart" VALUE="false">
<PARAM NAME="showcontrols" VALUE="false">
<embed ID="MediaPlayer"
TYPE="application/x-mplayer2"
SRC="_a.wmv"
WIDTH="160" HEIGHT="130"
AUTOSTART="0" SHOWCONTROLS="0">
</embed>
</OBJECT>
<br>

<IMG SRC="rodyti1.bmp" NAME="but"
border=0
onMouseOver="document.but.src='rodyti2.bmp'"
onMouseOut="document.but.src='rodyti1.bmp'"
onclick="document.MediaPlayer.play()">
</body>
</html>
 
How does it not work? What does it not do that it should? What does it do that it should not? Do you get any errors?

Help us to help you - give us more to go on.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
it works in IE- just when open a window- the movie plays one milisecond and stops,after clicking a button, the movie plays, but in mozilla I see only a black screen and after clicking the button nothing happens.
 
OK - You're using the ID "Mediaplayer" twice. IDs should always be unique, so this is wrong.

Also, you are using bad syntax to refer to the element - "document.MediaPlayer." is not really correct. You should use getElementById, and make sure you put the right ID in for whichever tag you are using (object or embed).

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top