The issue is you are not passing the
filepath
variable properly. Currently when its passed to the function
onDisp
it would be considered as a variable and then it would through an expression error as the data passed is not in correct format.
So, lets say your file path is like:
var filepath = 'C://Test/image.jpj'
but it would be passed as
<p><a href="javascript:onDisp(C://Test/image.jpj)">asasa</a></p>
since the proper qoutes to the
filepath
variable is not provided.
So, you can resolve it like:-
cont += '<p><a href="javascript:onDisp(\''+filepath+ '\')">' + DocHeader + '</a></p>';
Then you can test it inside the onDisp like:
function onDisp(filepath){
alert(filepath);
}
This will display correct output now.