Click to See Complete Forum and Search --> : Help with string manipulation...


jetson
04-18-2005, 10:41 PM
I'm trying to get js to write some html to a static web page (text file). I'm having trouble inserting double quotes around an href url. Here's what I want to write out to a file (along with the rest of the html for the entire page):

<td align=left><a href="www.somewhere.com">Link</a>

However, the url string between the double quotes is stored in an array element and needs to be resolved when the file is written.

So, in order to write this string to a text file, I'm using something like this (I know it won't work as written):

fo.Write( '<td align=left><a href=" + v[i] + ">Link</a>' );

I've tried using the slash escape character to embed the double quotes with no luck. Any help with this code is appreciated.

Kenny

phpnovice
04-18-2005, 10:52 PM
fo.Write( '<td align=left><a href="' + v[i] + '">Link</a>');

jetson
04-18-2005, 10:56 PM
..hmmm, that makes sense. I'll give it a try.

Thanks!

phpnovice
04-18-2005, 11:03 PM
Cheers.

jetson
04-18-2005, 11:12 PM
I'm new to js, so I struggled with this at work today. I was following examples in a book that did not mention single quotes, instead it used the slash escape character...

Thanks Again, all is working as expected now.

Kenny

phpnovice
04-18-2005, 11:18 PM
Yep, using all double-quotes, that would go like this:

fo.Write("<td align=left><a href=\"" + v[i] + "\">Link</a>");