Passing Javascript Replace function as an argument of user defined function


I am facing a problem in passing replace() function as an argument in user defined java function, can any one help me how to resolve it?

intention is to pass a file path to my user defined function, but before passing the path i want to replace the character ‘\’ to ‘\\’

I am posting my javascript function here:

<a href=“#” onclick=“OpenDocPreview(‘<%# Eval(“PATH”)%>’.replace(/\\/g,”\\\\“), ‘<%# Eval(“Filename”)%>’)”><%# Eval(“DocTitle”) %></a>

function OpenDocPreview(url, docname) {
alert('message from search base : ’ + url + ’ ’ + docname);

thank you,