Вы должны сделать это вместо:
<script type='text/javascript'>
(function () { // Closures are your friend
// Declare variables
var theDiv, theLink;
// Create the link and assign attributes
theLink = document.createElement('a');
theLink.innerHTML = 'efff';
theLink.href = '#';
theLink.onclick = function () {
openPhpFile('asdasD\\Asdeqw.txt');
};
// Get a reference to the container, empty the container and add the link
theDiv = document.getElementById('div');
theDiv.innerHTML = '';
theDiv.appendChild(theLink);
})();
</script>
Помните, что если вы echo
извлекаете PHP из двойных кавычек, вам действительно потребуется обратная косая черта 4 . Это потому, что PHP также будет использовать двойную обратную косую черту и будет выводить только одну. Поэтому, если вы хотите, чтобы PHP отображал 2 обратных слеша, вам нужно поставить 4 дюйма.