6 Replies Latest reply on Feb 23, 2010 4:47 PM by Roy Marshall

    [JS] Replace a slash in a file path

    Roy Marshall Level 1

      Hi.

       

      I have got the path for a file which contains slashes "/"

       

      I need to use that path in my Javascript to load styles into my Application.

       

      The syntax for that part requires colons to separate the folders, so I need to replace the slashes in the path.

       

      I have tried:

       

      mySlash = "\/";

      myNewFilePath = myFilePath.replace (mySlash, ":");

       

      but that doesn't replace.

       

      I have also tried:

      mySlash = "/";

      but with no luck either

      A similar line to replace "%20" with spaces works, so I know the replace function is working.

       

      Does anyone know how i should construct this? 

       

      Cheers

       

      Roy