473,409 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Using Javascript to change the text alignment of a DIV tag

tom
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

Jan 20 '06 #1
2 13798
Ivo
<to*@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

Jan 20 '06 #2
tom
Brilliant ... thanks for your help

Jan 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
0
by: blaircraig | last post by:
I have been having trouble with getting my pages to display correctly in IE (PC). They work fine in Firefox (PC), Safari (MAC), IE (MAC), Netscape (PC) but NOT IE (PC). I have tried alignment...
2
by: Tor Inge Rislaa | last post by:
How to change row height in a DataGrid I have DataGrid that is filled with data from a table in a DataSet. The content of the cells is text of more than one line (as a note field). What I...
0
by: Terry Brown | last post by:
I have a problem where, depending on the text of a button, the display of that text seems to change size or alignment. Here is the code: HomeScoreNameButton.ForeColor = Color.Green;...
2
by: dominic.martin | last post by:
Hi, I'm no javascript programmer but I found a really good piece of javascript at http://www.isdntek.com/tagbot/zipzoom.htm that magnifies areas of an image. It's just what I want but their...
2
by: Jerry | last post by:
I am writing text out to a text file and I want to LEFT justify the text. I wave found examples for the following: // Format a negative integer or floating-point number in various ways....
7
by: JDOMPer | last post by:
Don’t misunderstand me – I use AJAX, but I think there is a far simpler, elegant alternative that just uses Javascript, the DOM and Php ( hence - JDOMP) for data transfers, and is cross-browser...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.