@KorSep 22.2004 — #My question was simple: [b]what[/b] is that java method doing, in able to see, as far as my/our knowledge are, which can be the javascript equivalent. Your comment, jbot, is usless, according to the situation.
@jbotSep 22.2004 — #Your comment, jbot, is usless, according to the situation.[/QUOTE]
no, it's not.
i'm implying that he can script applets from Javascript, and therefore call Java's setTabSize() method.
this method sets the size of a tab in an applet or Java app. using Javascript within an HTML page, you could code the applet to change any applet tab. this is called LiveConnect (why don't you check it out before you start throwing platitudes about JS and Java not being conversant with each other).
now, of course, he might not want to be coding an applet. he may wanna create tabs in HTML and very well be mistaken that the similarities in names between JS and Java imply they also have similar objects, methods, properties, etc, in which case he'd be wrong. there is no tab tag in HTML and therefore no way to script one using JS (over and above using DHTML to simulate one).
hence there is no setTabSize() method in JS, because there are no tabs to create or alter. but that doesn't stop you from creating one, either to code your own DHTML tabs or else to script any given applet. that's wot i was harking at. but then again, you'd have known that if you weren't so prone to uttering the first thing that comes into your balkan bonce.
I have several one line read-only text fields that I'm using to output some numbers to. Because they are in a column, I would like the contents to be right justified. I thougth if I could use a tab, I could position them correctly - pad them so to speak. To tab, I would put an escape code for tab (09) in the string.
I know I could just put "spaces" in front of them but spaces are a fractional width of a normal character and thereby don't line the numbers up in all cases.
Yes, I also know I could use a div and get the effect I want but in my situation the read only input text field is best due to other restraints.
@jbotSep 22.2004 — #[i]Originally posted by Mike Burdick [/i]
[B]This is what I'm trying to accomplish:
I have several one line read-only text fields that I'm using to output some numbers to. Because they are in a column, I would like the contents to be right justified. I thougth if I could use a tab, I could position them correctly - pad them so to speak. To tab, I would put an escape code for tab (09) in the string.[/B][/QUOTE]
ahhhh ... i am mistaken on the tabs then.
well, try this:
[CODE] String.prototype.indent=function(type,size) { var s="";
for (var i=0; i<size.length; i++) { switch (type) { case "chars": s+=" "; break; case "tabs": s+="t"; break; } } return s+this; }[/CODE]
[COLOR=darkred]** code above has been edited **[/COLOR]
Your function is nice but what I really need is some way to SET the tab value. The nice thing about using the tab is that it moves over a nember of character spaces which doesn't depend on the width like a space. I think the space width is something like 3/5 th's of a normal character.
For some reason if I use that tab escape value it moves over 5 character spaces. I would like to be able to set it to other values as needed.
Anyway, this may not be possible, and I may only be able to pad it with normal spaces.
@jbotSep 23.2004 — #[i]Originally posted by Mike Burdick [/i]
[B]
For some reason if I use that tab escape value it moves over 5 character spaces. I would like to be able to set it to other values as needed.
Anyway, this may not be possible, and I may only be able to pad it with normal spaces. [/B][/QUOTE]
i reckon what you want is determined by the browser on the application level and not the document level. hence that sorta functionality is probably outta reach.
the only other solution i can think of is to insert a span into any string derived from the field's value. the content of the span would be x number of spaces, the font size of which would 3/5 em sizes of the field's typeface. that sounds kinda convoluted tho, so i'm not gonna code that (i've got my own work to do after all).
anyway, as i understand it, a tab space is normally measured by x number of spaces. so, for example, in any text editor i may use to write HTML, i can set the tab size to 5 or 10 or whatever number of spaces i want.