Hi all i am trying to call javascript function called loadvideo from php echo and i keep getting errors. I tried two methods
1)first Method i get this error:
Parse error: syntax error, unexpected '<' in
echo ("<td><a href=\"javascript:loadVideo('$URL\','image1.jpg')">$item['name']</a> <br/></td>\n");
2)second method i get this error:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
echo ("<td><a onClick='loadVideo(" . $URL . ");'>$item['name']</a><br/></td>\n");
could any one show me how to fix this ?Thanks in advance.
javascript function to call:
<script>
function loadVideo(myFile,myImage) {
jwplayer().load([{
file: myFile,
image: myImage
}]);
jwplayer().play();
};
</script>