Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6830739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:39:15+00:00 2026-05-26T22:39:15+00:00

This is my code: <script> document.getElementById(div’).innerHTML = ‘<a href=javascript:void(0); onclick=openPhpFile (\’asdasD\\Asdeqw.txt\’);>efff</a>’; </script> When the

  • 0

This is my code:

<script>
document.getElementById(div').innerHTML = '<a href="javascript:void(0);" onclick="openPhpFile (\'asdasD\\Asdeqw.txt\');">efff</a>';
</script>

When the openPhpFile function runs, I alert the filename, and the \ characters are gone, even though they are doubled. addslashes() doesn’t help; what can it be?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:39:16+00:00Added an answer on May 26, 2026 at 10:39 pm

    You should do this instead:

    <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>
    

    Remember that if you are echoing the from PHP inside double quotes, you will actually need 4 backslashes. This is because PHP will also use the double backslash sequence, and would only output one. So if you want PHP to echo 2 backslashes, you need to put 4 in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this JavaScript Code: <script type=text/javascript> function loop(Message){ document.getElementById('output').innerHTML = document.getElementById('output').innerHTML + Message +
i have this code for get data from textfield: <script type=text/javascript> var mod=document.getElementById(mod).value; ajax(mod);
I have this javascript code: <script type=text/javascript> function editHiddenInput(CarType) { document.getElementById('sellingcarname') = CarType; }
This is my script: HTML Code: <script> function pickIt(pId){ if(document.getElementById(pId).checked==true){ document.getElementById(pId).checked=false; }else{ document.getElementById(pId).checked =
Say I have this code in my page: <script language=javascript> $(document).ready(function() { $(.test).click(function() {
I used this code for sending and returning result. <script type=text/javascript> $(document).ready(function() { $('.special').click(function(){
I have this code running great in ff, opera and chrome: <script type=text/javascript> $(document).ready(function(){
This is my JavaScript code: <script> function change(name){ var element = document.all.name.value; } </script>
This is my jQuery code <script type=text/javascript> jQuery(document).ready(function($){ $(#'.$tag.').dcFlickr({ limit: '.$nFlickr.', style: thumb, q:
i have a javascript function like this: function addfamily(divName){ var newdiv = document.createElement('div'); newdiv.innerHTML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.