Embedding Non-Breakable Spaces into Strings -- How?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hal Vaughan

    Embedding Non-Breakable Spaces into Strings -- How?

    I have a list of variables and values (merge fields for a merge program) and
    I want to put them in a list in a <SELECT> object. I'd like them to be
    lined up, with an "=" midway between the field and the value. I was going
    to fill the space between with spaces, but I noticed a number of spaces are
    condensed to one (like in all other parts of HTML). I tried filling it
    with non-breakable spaces, like this:

    var line = "MyMergeField&n bsp;&nbsp;&nbsp ;=&nbsp;&nbsp;& nbsp;MyValue";

    And the non-breakable space is not interpreted -- it is entered into the
    string literally. Is there a way to enter this character into a string?
    Perhaps by hex value? Or is there some other way I can create spacing to
    line up the equals signs so it looks good to users?

    Thanks!

    Hal
  • Fox

    #2
    Re: Embedding Non-Breakable Spaces into Strings -- How?



    Hal Vaughan wrote:[color=blue]
    >
    > I have a list of variables and values (merge fields for a merge program) and
    > I want to put them in a list in a <SELECT> object. I'd like them to be
    > lined up, with an "=" midway between the field and the value. I was going
    > to fill the space between with spaces, but I noticed a number of spaces are
    > condensed to one (like in all other parts of HTML). I tried filling it
    > with non-breakable spaces, like this:
    >
    > var line = "MyMergeField&n bsp;&nbsp;&nbsp ;=&nbsp;&nbsp;& nbsp;MyValue";[/color]

    var nbsp = String.fromChar Code(160);

    line = nbsp + nbsp + MyValue;


    [color=blue]
    >
    > And the non-breakable space is not interpreted -- it is entered into the
    > string literally. Is there a way to enter this character into a string?
    > Perhaps by hex value? Or is there some other way I can create spacing to
    > line up the equals signs so it looks good to users?[/color]

    different fonts have differing spacing characteristics (no telling what
    the user has set up) -- you might want to "force" a monospace font for
    the style of the select.

    I think Andale Mono will work, as will Courier New, but always fall back
    on the generic "monospace" to make sure.[color=blue]
    >
    > Thanks!
    >
    > Hal[/color]

    Comment

    • Hal Vaughan

      #3
      Re: Embedding Non-Breakable Spaces into Strings -- How?

      Fox wrote:
      [color=blue]
      >
      >
      > Hal Vaughan wrote:[color=green]
      >>
      >> I have a list of variables and values (merge fields for a merge program)
      >> and
      >> I want to put them in a list in a <SELECT> object. I'd like them to be
      >> lined up, with an "=" midway between the field and the value. I was
      >> going to fill the space between with spaces, but I noticed a number of
      >> spaces are
      >> condensed to one (like in all other parts of HTML). I tried filling it
      >> with non-breakable spaces, like this:
      >>
      >> var line = "MyMergeField&n bsp;&nbsp;&nbsp ;=&nbsp;&nbsp;& nbsp;MyValue";[/color]
      >
      > var nbsp = String.fromChar Code(160);
      >
      > line = nbsp + nbsp + MyValue;[/color]

      Thanks -- exactly what I needed!
      [color=blue]
      >[color=green]
      >>
      >> And the non-breakable space is not interpreted -- it is entered into the
      >> string literally. Is there a way to enter this character into a string?
      >> Perhaps by hex value? Or is there some other way I can create spacing to
      >> line up the equals signs so it looks good to users?[/color]
      >
      > different fonts have differing spacing characteristics (no telling what
      > the user has set up) -- you might want to "force" a monospace font for
      > the style of the select.
      >
      > I think Andale Mono will work, as will Courier New, but always fall back
      > on the generic "monospace" to make sure.[/color]

      I already set that up, since the rest of my page is in Arial.


      Thanks for the help!

      Hal

      Comment

      Working...