Replacing blanks with  

W

wyo

I'd like to display folder names without line breaks so I tried the
following replace

folders[j] = f.replace(/ /g, ' ');

but the script stop without an error. Any idea? Is there a better way?

O. Wyss
 
L

Lee

wyo said:
I'd like to display folder names without line breaks so I tried the
following replace

folders[j] = f.replace(/ /g, ' ');

but the script stop without an error. Any idea? Is there a better way?

alert("f: "+f);
alert("f after replace: "+f.replace(/ /g,' ');
alert("j: "+j);
alert("folders[j]: "+folders[j]);


--
 
L

-Lost

Lee said:
wyo said:
I'd like to display folder names without line breaks so I tried the
following replace

folders[j] = f.replace(/ /g, ' ');

but the script stop without an error. Any idea? Is there a better way?

alert("f: "+f);
alert("f after replace: "+f.replace(/ /g,' ');
alert("j: "+j);
alert("folders[j]: "+folders[j]);

Missing a quote on the second line.

I am confused though. Are you wanting to replace blanks with   or \n?

Or are you wanting to replace \n with  ?
 
L

Lee

-Lost said:
wyo said:
I'd like to display folder names without line breaks so I tried the
following replace

folders[j] = f.replace(/ /g, ' ');

but the script stop without an error. Any idea? Is there a better way?

alert("f: "+f);
alert("f after replace: "+f.replace(/ /g,' ');
alert("j: "+j);
alert("folders[j]: "+folders[j]);

Missing a quote on the second line.

Look again.
I am confused though. Are you wanting to replace blanks with   or \n?

Or are you wanting to replace \n with  ?

The OP wants to replace blanks with  , to prevent line breaks.


--
 
L

-Lost

Lee said:
-Lost said:
Lee said:
wyo said:
I'd like to display folder names without line breaks so I tried the
following replace

folders[j] = f.replace(/ /g, ' ');

but the script stop without an error. Any idea? Is there a better way?
alert("f: "+f);
alert("f after replace: "+f.replace(/ /g,' ');
alert("j: "+j);
alert("folders[j]: "+folders[j]);
Missing a quote on the second line.

Look again.

OK, I did. I realize I meant to say parenthesis. You are missing an ).
The OP wants to replace blanks with  , to prevent line breaks.

Ah, was not sure since he said two different things.
 
W

wyo

What does "stops working" mean?
what is alerted before it stops?
It doesn't show the alert nor anything else after the script reaches
the "replace". It neither shows an error in the error console of
Mozilla. Ditto IE6 but there isn't an error console.

O. Wyss
 
L

Lee

wyo said:
It doesn't show the alert nor anything else after the script reaches
the "replace". It neither shows an error in the error console of
Mozilla. Ditto IE6 but there isn't an error console.


--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,163
Messages
2,570,897
Members
47,434
Latest member
TobiasLoan

Latest Threads

Top