Click to See Complete Forum and Search --> : Follow up questions for nesting ", ', \'


dance621
11-18-2006, 08:15 AM
Hi, I asked a question yesterday about replacing " with ' in my script because it needs to be exported in csv and csv hates ". Felgall helped and said I can use ' and \'. However, there are instances in the script where I need an extra level of nesting (third level). Actually the script at that point involves some javascript also. Is there a way of writing this so that I do not need any quotes ("). I played around but could get anything to work. I also cannot call remote scripts which is a pain because life would have been a lot easier!

Here is the bit that needs to be without quotes...

<TD vAlign=top width=45><div class="pic"><A href="#topanchor"
onclick="
imagew1.src='http://hardyart.co.uk/frame/wall1.jpg';
bselw.src='http://www.hardyart.co.uk/frame/selectwall.gif';
bselft.src='http://www.hardyart.co.uk/frame/selectframetext.gif';
bselomt.src='http://www.hardyart.co.uk/frame/selectoutmounttext.gif';
bselst.src='http://www.hardyart.co.uk/frame/selectsliptext.gif';
document.getElementById('imagew1').style.backgroundImage =
'url(\'http://hardyart.co.uk/frame/wall1s.jpg\')';">
<IMG name=imagewi1 src="http://hardyart.co.uk/frame/wall1.jpg" Title="Pure white" border=0></A></div></TD>

Any ideas?

I think this below was my best attempt but still didnt like it (invalid character which must be the slosh-quote?...

<TD vAlign=top width=45><div class='pic'><A href='#topanchor'
onclick='
imagew1.src=\'http://hardyart.co.uk/frame/wall1.jpg\';
bselw.src=\'http://www.hardyart.co.uk/frame/selectwall.gif\';
bselft.src=\'http://www.hardyart.co.uk/frame/selectframetext.gif\';
bselomt.src=\'http://www.hardyart.co.uk/frame/selectoutmounttext.gif\';
bselst.src=\'http://www.hardyart.co.uk/frame/selectsliptext.gif\';
document.getElementById(\'imagew1\').style.backgroundImage =
\'url(http://hardyart.co.uk/frame/wall1s.jpg)\';'>
<IMG name=imagewi1 src='http://hardyart.co.uk/frame/wall1.jpg' Title='Pure white' border=0></A></div></TD>

Thanks! James

NogDog
11-18-2006, 11:38 AM
For the 3rd level of single quotes, you would have to "escape the escape":

'this is level one. \'this is level two. \\\'this is level three.\\\'\''

PS: CSV files can handle double quotes just fine if whatever is doing the reading and writing to the CSV file knows what it's doing. Any field with a double quote or a comma in it must be quoted with double quotes, and then any actual double quotes in the field data must be doubled up:
This is, "A test."
...becomes...
"This is, ""A test."""
PPS: What does this all have to do with CSS, anyway? :confused:

dance621
11-18-2006, 01:29 PM
Thanks. Actually yesterday it was all to do with css. Just sort of became html with a little js mixed in. Cheers for the tips. I had a lot of difficulty tracking that info down on the web. Difficult to google \' !!!