All,
Please bear with me since I am very, very new to Javascript and the likes ?
I am trying to write a simple (at least I thought it would be) application in PHP with some javascript. This simple code would basically allow to count the number of CD drives on the client. I’ve taken a look at MSDN and the WMP API and from what I can tell I have the correct code, but nothing is happening. Can anyone provide a helping hand? Code is as follows: –
<html>
<head>
<title>TEST</title>
</head>
<body>
<object id=”Player”
classid=”clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6″
height=”160″
width=”120″>
<param name=”uiMode” value=”full”>
<param name=”autoStart” value=”false”>
<param name=”enabled” value=”true”>
</object>
<?php
echo ‘WMP Test’;
?>
<script language=”javascript”>
{
var mycount=0;
var message;
mycount = Player.cdromcollection.count;
message=”I am here”;
alert(message);
if (mycount == 0)
{
message=”No CD Rom Drives Available”;
alert(message);
}
}
</script>
</body>
</html>
Nothing seems to happen at all, apart from the printing of the test “WMP Test” and the WMP being visible. The alert is not showing. If I take out the line:
mycount = Player.cdromcollection.count
Then the alert(message); in the following line is coming up.
There are no javascript errors so I am at a loss as to why mycount = Player.cdromcollection.count is not working. It’s what is specified on the MSDN pages.
Thanks in advance for any help and/or pointers ?