...

View Full Version : Help with replacing  



takuhii
10-18-2005, 04:45 PM
Is it possible to create a javascript that replaces the   within a HTML document with a regular space.

Basically my problem is this. I have a piece of Java code which spits out a string of options based on how a user navigates to a page, unfortunately for all the white space generated by this code it puts in   instead of a space. As i don't own the code that creates the string, I cannot edit it from that end, so I thought I could write a quick JavaScript that would find instances of   and replace them with a regular old space.

Any help would be greatly appreciated.

jbezweb
10-18-2005, 05:12 PM
are you a ware that if you replace,say, 6   with 6 regular spaces the browser will treat it as only 1 space?

If you don't care I can show you how to remove the  's

takuhii
10-19-2005, 02:18 PM
That would be great, the string only spits out one   between options, , kinda like:

Option 1 Option2 Option3 and so on...

Luckily it's the only bit on the page like this, so that would be an ideal solution if you would show me. Thank you

ca_redwards
10-19-2005, 05:32 PM
Is it possible to create a javascript that replaces the   within a HTML document with a regular space.

Basically my problem is this. I have a piece of Java code which spits out a string of options based on how a user navigates to a page, unfortunately for all the white space generated by this code it puts in   instead of a space. As i don't own the code that creates the string, I cannot edit it from that end, so I thought I could write a quick JavaScript that would find instances of   and replace them with a regular old space.

Any help would be greatly appreciated.


document.body.innerHTML=document.body.innerHTML.replace(/\&nbsp\;/g,' ');



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum