Connecting Tech Pros Worldwide Forums | Help | Site Map

Concat String

rockocubs
Guest
 
Posts: n/a
#1: Jul 23 '05
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
Guest
 
Posts: n/a
#2: Jul 23 '05

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.writeln(str);

</script>
</body>

rockocubs
Guest
 
Posts: n/a
#3: Jul 23 '05

re: Concat String


Thanks so much, you made that easy.

Lee
Guest
 
Posts: n/a
#4: Jul 23 '05

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

Closed Thread


Similar JavaScript / Ajax / DHTML bytes