Concat String

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rockocubs

    Concat String

    I want to form a string that contains string and variavles.

    Such as
    var response = prompt("Enter Pcr Number?","");
    var str = "'H:\' response '\hi3.dot'";

    So i want to fill in the string with the response.

  • RobB

    #2
    Re: Concat String

    rockocubs wrote:[color=blue]
    > I want to form a string that contains string and variavles.
    >
    > Such as
    > var response = prompt("Enter Pcr Number?","");
    > var str = "'H:\' response '\hi3.dot'";
    >
    > So i want to fill in the string with the response.[/color]

    <body>
    <script type="text/javascript">

    var str = [ "H:", prompt("Enter Pcr Number",""), "hi3.dot"
    ].join("\\");

    document.writel n(str);

    </script>
    </body>

    Comment

    • rockocubs

      #3
      Re: Concat String

      Thanks so much, you made that easy.

      Comment

      • Lee

        #4
        Re: Concat String

        rockocubs said:[color=blue]
        >
        > I want to form a string that contains string and variavles.
        >
        > Such as
        > var response = prompt("Enter Pcr Number?","");
        > var str = "'H:\' response '\hi3.dot'";
        >
        >So i want to fill in the string with the response.[/color]

        var str = "H:\\" + response + "\\hi3.dot" ;

        Comment

        Working...