javascript eval backslash in window NT path problem
Posted
by Hammad Tariq
on Stack Overflow
See other posts from Stack Overflow
or by Hammad Tariq
Published on 2010-06-15T11:58:51Z
Indexed on
2010/06/15
12:02 UTC
Read the original article
Hit count: 455
JavaScript
|eval
I am experiencing a classic JS case (in my opinion) but after a lot of googling, still not able to find a solution. Backslash is considered as a escape character in JS but what you need when you need to pass windows path from the JS and print it?
I am using eval because my java applet is executing the code and placing bits when it has a string to evaluate. That's why eval is necessary, however I have made an example which is below:
<div id="mainTabs"></div>
<script>
var s = "document.getElementById('mainTabs').innerHTML='\\C\ganye\file.doc'";
eval(s);
</script>
I tried double backslashes, not working, if anyone could help me get around this with as less hassle as possible, I will feel grateful.
© Stack Overflow or respective owner