/    Sign up×
Community /Pin to ProfileBookmark

Does anyone know if using the alt+255 method to create spaces in a string is a no-no in javascript?

That is, I want to add a few blank spaces at the end of a string and they won’t persist. Only the alt+255 method works here:

“+date+”, “+year+” “+hr+”:”+min+”:”+sec+ap+” “+” “+” “;

Thanks,

Terry

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@herodote92Oct 06.2005 — It's no use mentioning several following blanks in HTML, they will be considered as only one. You might use   although in my opinion it's not a very nice programming style: only in case of real need...
Copy linkTweet thisAlerts:
@felgallOct 06.2005 — <span style="white-space:pre"> </span>

put as much whitespace between the tags as you need.
Copy linkTweet thisAlerts:
@tpeckauthorOct 07.2005 — Right - but how do you put a span in javascript? Isn't the ALT-255 approach acceptable?
Copy linkTweet thisAlerts:
@herodote92Oct 07.2005 — More info here: http://en.wikipedia.org/wiki/Space_character

Why do you exactly need a sequence of spaces ?
Copy linkTweet thisAlerts:
@tpeckauthorOct 07.2005 — I'm displaying the date aligned top right in a div layer - works well but butts up against the scroll bar. The alt-255 method works well but I am slightly concerned that it is non-standard and may not work in all cases. But it seems from your reference that it is a line-breaking scenario which will not affect me.

Thanks,

Terry
Copy linkTweet thisAlerts:
@herodote92Oct 07.2005 — Wouldn't it be better to play with the container style ? (position, width, margins, padding...)
×

Success!

Help @tpeck spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...