473,788 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.sty le.top="100px"; '
but when I try to change the text alignment with the following:

'window.xxx.sty le.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 13815
Ivo
<to*@loopy.co.u k> wrote

It's no problem doing things like this: 'window.xxx.sty le.top="100px"; '
but when I try to change the text alignment with the following:

'window.xxx.sty le.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.styl e.textAlign="le ft";
window.xxx.styl e.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
9651
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 assigned to a variable and output using document.write. (Note, there is no submit button or other form elements. Basically
0
2441
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 issues with div's in the body etc. This is the link to the site: http://members.dodo.com.au/~craigblair/cave/contactus.html and here is the code for you to view: Many thanks in hope that someone mioght be able to help..... <html>
2
3399
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 want is to set the height of the row based on the number of lines in it. The row height of each row in the table may be different from each other. Is there a way to do this?
0
1140
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; HomeScoreNameButton.Font = new System.Drawing.Font("Tahoma", 8.50F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)); this.HomeScoreNameButton.Location = new System.Drawing.Location(10,10);
2
4797
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 example only allows for a button in the HTML body to turn the magnifier on: <input type="button" onclick="initMagnifier()" value="Use Magnifier"> I would like two buttons; one to activate the magnifier and one to
2
2051
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. Console.WriteLine("Standard Numeric Format Specifiers"); Console.WriteLine( "(C) Currency: . . . . . . . . {0:C}\n" + "(D) Decimal:. . . . . . . . . {0:D}\n" + "(E) Scientific: . . . . . . . {1:E}\n" +
7
2024
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 without the need for work arounds. JDOMP works in recent versions of Explorer, Mozilla, Safari and Opera. Please note I will not deal with security issues which are always an issue whenever there is access to a database. You can simply change text on...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10112
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.