sde,
It is possable in Javascript, as i have acheived it, only an error message displays at execution. This reads as follows:
- Stack overflow at line: 0
Can you/anybody tell me why this is? See code below.
I would prefer to do it in Javascript rathewr than PHP as it will only be used on my machine not uploaded to a server.
Code:
<script type="text/javascript">
function play(media) {
var promptStr = 'Playing:'+media.substring(media.lastIndexOf('/')+1)+'<br>';
var objectStr = '<object classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95"'+'type="application/x-oleobject" width="412" height="276">'+
'<param name="showControls" value="false">'+
'<param name="fileName" value="'+media+'">'+
'<embed type="application/x-mplayer2" width="320" height="285"'+'showcontrols="true" src="'+media+'"><\/embed>'+
'<\/object>'
document.getElementById('mediaplayer').innerHTML=promptStr+objectStr;
}
var myImages = new Array();
var i=1;
var dir = "images/"
function loadNext(thePic) {
var theSrc=thePic.src;
var w=thePic.width;
var h=thePic.height;
if (w<h) { // portrait
w=54;
h=74;
}
else { // landscape
w=74;
h=54;
}
myImages[myImages.length]='<img src="'+theSrc+'" width="'+w+'" height="'+h+'" border="0">';
document.loadImage.src=dir+(i++)+'.gif'
}
function show() {
window.status='Done'
var text = '';
text +='<table border="0">'
for (var i=0;i<myImages.length;) {
text += '<tr>'
for (var j=0;j<3 && i<myImages.length;j++) {
text +='<td><a href="'+dir+i+'.wmv" onClick="play(\''+dir+i+'.wmv\'); return false">'+
myImages[i]+'</a></td>';
i++;
}
text += '</tr>'
}
document.getElementById('allLinks').innerHTML=text;
}
</script>
<div id="allLinks"></div>
<div id="allImages" style="display:none">
<img
src="images/0.gif" name="loadImage" width="150" height="108" onError="show()" onLoad="loadNext(this)">
</div>
<ul id="menu">
<li><a onclick="play('box1.wmv');return false" href="">Source 1</a></li>
<li><a onclick="play('1.mpg');return false" href="">Source 2</a></li>
<li><a onclick="play(this.href);return false" href="">Source 3</a></li>
</ul>
<div id="mediaplayer"></div>
Many Thanks,