May 25, 2005

Javascript Coding Question

I have a question for the extreme technically skilled people around here. I am using an external javascript that someone else has created -- I cannot change this script in any way. However, that script generates code for the site that I want to change -- I want to convert <BR> tags to spaces or something else. I don't think this is possible, but I figured I'd ask.

I can make the <BR> tags disappear completely without a problem -- but then all the items appear mashed together and I would like spaces between them.

Anyone have any clues?

Posted by Ogre at May 25, 2005 02:47 PM
Comments
#1

Oh, and in case it matters, the external javascript is using document.write to put the characters on the screen.

Posted by Ogre at May 25, 2005 02:48 PM
#2

Right now you have a most interesting horizontal blog, the first I've seen! But it is keeping me from making sense of what you are talking about - I presume you are in the middle of working on it. So, without trying to verify by looking at your code, may I suggest the following?

Instead of writing <BR>, write &nbsp;

Posted by David Boxenhorn at May 26, 2005 08:22 AM
#3

The specific issue with that blog is related to that absurdity -- external blogrolls (maintained by others) are set up to be vertical with entries separated by <BR> tags. With this weird layout, I need them to be horizontal.

So I'd like to write nbsp's, but the code that's writing the <BR> tags is not accessible to me -- and that's the problem. Thanks for the suggestion, though.

Posted by Ogre at May 26, 2005 10:41 AM
#4

Well, you could write a little cgi script that transforms the Javascript on the fly.

Or write a Javascript program that does the same thing. At least, I think you can do that.

Not sure if you want to go to that much trouble.

Posted by Pixy Misa at May 26, 2005 01:56 PM
#5

I wouldn't mind -- I'm just not sure it's possible. The javascript code is writing directly to the page with document.write. I don't know that it's possible, even with another javascript program, to intercept that action. My primary problem is that the original javascript is not accessible to me -- I can find out what it does but I cannot modify it.

Posted by Ogre at May 26, 2005 06:17 PM
#6

Here's an idea: Put the javascripts in their own invisible frames (size 0 by 0). Then write your own scripts in the main body to read the code that the imported javascripts produce, and write them out, making whatever substitutions you want.

Posted by David Boxenhorn at May 26, 2005 07:18 PM
#7

David - yep, that's what I was thinking.

I think a CGI script would be easier though.

Posted by Pixy Misa at May 27, 2005 03:15 AM
#8

Thanks for the ideas, both of you. I'll play some and see what I can come up with.

Posted by Ogre at May 31, 2005 05:38 PM
Live Comment Preview
Post a comment









Remember personal info?