Web Analytics Made Easy -
StatCounter Using a \ in () - CodingForum

Announcement

Collapse
No announcement yet.

Using a \ in ()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using a \ in ()

    I have script that uses () and I need to put a \ in it. Since \ is normally used to allow special characters like that and when doubled it means a comment line, I'm having some trouble.
    I've tried
    Code:
    group('1','../../../music[B]\[/B]song.wav'), 
    group('1','../../../music[B]\\[/B]song.wav'), and
    group('1','../../../music[B]/[/B]song.wav')
    with no success.

    So, how can you use a backslash like that?
    Oh, was I supposed to put something here? ........

  • #2
    Is it even possible?
    Oh, was I supposed to put something here? ........

    Comment


    • #3
      you use two \\ to do it....

      // is a comment....
      Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

      Comment


      • #4
        Your second example should work by escaping the reserved character.

        eg:
        Code:
        <script type="text/javascript">
        var group = new Array()
        group[0]=new Array('1','..\\..\\..\\music\\song.wav')
        alert(group[0][1])
        </script>
        .....Willy

        Comment


        • #5
          Okay I changed it that with no success.
          Last edited by Bobo; Feb 19, 2004, 01:43 PM.
          Oh, was I supposed to put something here? ........

          Comment


          • #6
            You're looking at the wrong thing for the problem as the code below will demonstrate:

            Code:
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html>
            	<head>
            		<title>Testing</title>
            	</head>
            	<body>
            		<script language="javascript" type="text/javascript">
            			alert('../../../music\\song.wav')
            		</script>
            	</body>
            </html>
            Edit-------------

            As a thought, with that out of place backslash it looks like you're feeding information back to the host. Have you though about using '../../../music\\\\song.wav' in case the host is also swallowing a pair of backslashes?
            Last edited by Roy Sinclair; Feb 19, 2004, 01:51 PM.
            Check out the Forum Search. It's the short path to getting great results from this forum.

            Comment


            • #7
              I assumed the O/P was trying to link to sound files on his/her hard drive. If the files are on a server. Why is there a backslash even in the file name?

              ../../../music\\song.wav ?????

              .....Willy

              Comment


              • #8
                Got it guys; thanks!!
                BTW, it was on my harddrive for temporary use until I find a server.
                Oh, was I supposed to put something here? ........

                Comment

                Working...
                X