Hi all,
i have the following code
[CODE]<body onload=”showvideos()”>
<div id=”video_container” style=”width:100%”>
</div>
<script>
function showvideos()
{
//I do not own the image or the video used in this example, both belong to their respected owners and are being used purely as tests //
var videos=[
‘http://clips.vorwaerts-gmbh.de/VfE_html5.mp4’,”http://www.okcareertech.org/cac/images/Video_Icon.jpg”,
‘http://clips.vorwaerts-gmbh.de/VfE_html5.mp4’,”http://www.okcareertech.org/cac/images/Video_Icon.jpg”,
‘http://clips.vorwaerts-gmbh.de/VfE_html5.mp4’,”http://www.okcareertech.org/cac/images/Video_Icon.jpg”,
‘http://clips.vorwaerts-gmbh.de/VfE_html5.mp4’,”http://www.okcareertech.org/cac/images/Video_Icon.jpg”,
‘http://clips.vorwaerts-gmbh.de/VfE_html5.mp4’,”http://www.okcareertech.org/cac/images/Video_Icon.jpg”,
‘http://clips.vorwaerts-gmbh.de/VfE_html5.mp4’,”http://www.okcareertech.org/cac/images/Video_Icon.jpg”,
‘http://clips.vorwaerts-gmbh.de/VfE_html5.mp4’,”http://www.okcareertech.org/cac/images/Video_Icon.jpg”,
‘http://clips.vorwaerts-gmbh.de/VfE_html5.mp4’,”http://www.okcareertech.org/cac/images/Video_Icon.jpg”,
];
var videoHTML=[];
var rownumber=4;
var div_elm = document.getElementById(“video_container”);
for(var i=1;i<videos.length;i+=2)
{
videoHTML.push(“<image onclick=’showpreview(‘”+ videos[i-1] + “‘ src='” + videos[i] + “‘</image>”);
rownumber–;
if(rownumber == 0)
{
videoHTML.push(“<br><hr><hr>”);
rownumber = 4;
}
div_elm.innerHTML = videoHTML.join(” “);
var video_nodes = div_elm.getElementsByTagName(“img”);
for(var num=0;num<video_nodes.length;num++)
{
video_nodes[num].style.width=(98/rownumber) + “%”;
video_nodes[num].style.height=”200px”;
}
};
}
function showpreview(number)
{
var previewelm = document.getElementById(“video_container”);
previewelm.innerHTML = “<video width=’320′ height=’240’ controls><source src='” + number + “‘ type=’video/mp4’></video>”
alert(number)
}
</script>
</body>
I am getting the common Uncaught SyntaxError: Unexpected token } error, the problem is I’m not sure as to why ….
Line 29 and possible the showpreview(number) function as the possible courses that are doing is as I think it is happening when I pass the string to the function.
I have tried to get around this area of “errors” by passing the videos variable (such as videos[i]) itself but this seems to course completely irrelevant errors so i’m lost.
Any help would be great,
Thanks