/    Sign up×
Community /Pin to ProfileBookmark

adding spaces to beginning of text

I am trying to add spaces to indent to text on a link.

But it keepson ignoring the spacer var????

function showSubMenu(){
var spacer = ” “;
document.getElementById(‘previous’).firstChild.data = spacer + ” – GMC 2006″;
document.getElementById(‘accomodation’).firstChild.data = spacer + ” – Guttane Concert”;

}

I know it sounds easy but I cant get it to work

Any ideas???

John

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoNov 22.2006 — You don't specify exactly what you are trying to do, but if you are trying to format your text try using the padding attribute or align=center
Copy linkTweet thisAlerts:
@JMRKERNov 22.2006 — You might try:

var spacer='   ' // repeat or put in 'for...loop count' as needed.
Copy linkTweet thisAlerts:
@john_nobleauthorNov 22.2006 — var spacer='   '

This adds the text ' ' to the text - not an actual space

Thanks,

John
Copy linkTweet thisAlerts:
@ayse_incebulutNov 22.2006 — [code=php]

<body>

<div id="id"></div>


<script type="text/javascript">

function showSubMenu(){

var div = document.getElementById('id');
div.style.textIndent = "200px" ;
div.innerHTML = "Guttane Concert" ;

}
showSubMenu() ;

</script>
[/code]
×

Success!

Help @john_noble 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.17,
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,
)...