![]() |
Using Javascript to change the text alignment of a DIV tag
Hi there,
In IE, I am trying to govern various style attributes of a DIV tag with javascript. It's no problem doing things like this: 'window.xxx.style.top="100px";' but when I try to change the text alignment with the following: 'window.xxx.style.text-align="left";' .... I get a syntax error probably due to the hyphen. Does anyone have any ideas about this? Other style attributes can be changed but not text alignment. I would be very grateful for some help. Thanks .... Tom |
Re: Using Javascript to change the text alignment of a DIV tag
<tom@loopy.co.uk> wrote
> > It's no problem doing things like this: 'window.xxx.style.top="100px";' > but when I try to change the text alignment with the following: > > 'window.xxx.style.text-align="left";' > > ... I get a syntax error probably due to the hyphen. That 's right. To avoid the hyphen, you write combinations of words in camelcase, with the first letter of the next word capitalized: window.xxx.style.textAlign="left"; window.xxx.style.fontSize="110%"; etc. -- hth ivo http://4umi.com/web/javascript/camelcase.htm |
Re: Using Javascript to change the text alignment of a DIV tag
Brilliant ... thanks for your help
|
| All times are GMT. The time now is 07:44 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.