Pass a path as a param to a JS function
<p>This code is a simple function call:</p>

<pre><code>&lt;input type="submit" name="_eventId_load" onclick="toLoad('2012\9\27\15\2012-09-27T15-05-59-512.00638.eml');" value="Load"/&gt;
</code></pre>

<p>This is what I receive in the js function:</p>

<pre><code> function toLoad(path) {
    document.getElementById("emailPath").value = escapepath);
}
</code></pre>

<p>Via firebug, I see that the param <code>path</code> contains: <code>201292-09-27T15-05-59-512.00638.eml</code><br>
And after the scape function: <code>20129%17%0D%812-09-27T15-05-59-512.00638.eml</code></p>

<p>The values are completely different. How could I work/edit te <code>\</code> before I send it to the js function?</p>

<p>Thanks in advance.</p>

<p><strong>EDIT</strong></p>

<p>This is the solution:</p>

<pre><code>&lt;input id="filePath-${status.index}" type="hidden" value="${file.path}"/&gt;
&lt;input type="submit" onclick="toLoad('${status.index}'" value="Load"/&gt;
</code></pre>

<p>These inputs are inside a form, each element is a file. I need <code>${status.index}</code> to know which file I want to load. <code>${file.path}</code> contains the path I want to replace.</p>

<pre><code>function toLoad(index) {
    var emailPath = document.getElementById("filePath-" + index).value.replace(/\\/g,"\\\\");
    document.getElementById("emailPath").value = emailPath;
}
</code></pre>

<p>The correct input will be included in a div, so I can use it for the final functionallity.</p>

<p>Thanks for your answers!</p>
