473,738 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Other method to access style property?

Hi,

Due to a restriction on the host, I'm not allowed to use .style, so I'm
unable to manipulate the style property of the element. Is there any
other way to get to style without using something like
getElementById( id).style ? Is there any method sorta like
getElementById( id).getStyle ? Thanks much.

Jul 23 '05 #1
2 1170
On 02/05/2005 09:44, ta*******@gmail .com wrote:
Due to a restriction on the host, I'm not allowed to use .style [...]


Are you not allowed to manipulate the style object, or just not allowed
to use '.style', literally. If it's the latter, then use square bracket
notation:

obj['style']

If you cannot manipulate the style object, you will not be able to alter
the inline style of the element. However, you could change the class
attribute:

obj.className = 'new-style';

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
> Are you not allowed to manipulate the style object, or just not
allowed
to use '.style', literally. If it's the latter, then use square bracket notation:

obj['style']
That's exactly what I needed. Thanks much, Mike. I was thinking of
using the square brackets and somehow, I drifted away from actually
playing with it (well, the effect of late night I guess).
If you cannot manipulate the style object, you will not be able to alter the inline style of the element. However, you could change the class
attribute:

obj.className = 'new-style';

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.


Jul 23 '05 #3

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

Similar topics

3
2085
by: Christopher Jeris | last post by:
Please help me understand the differences, in semantics, browser support and moral preferredness, between the following three methods of swapping content in and out of a page via JavaScript. I would also appreciate any general criticism you have to offer. I don't know yet how to write the degradation-path code for browsers that don't support the DOM methods I'm using, so there are some commented-out paths below. If the content...
5
1974
by: Andrew Poulos | last post by:
If I have an external stylesheet that is @imported into my page and it has an element that looks like this: * html td { font-style: italic; } how can I use javascript to change the font style to 'normal'? Andrew Poulos
12
2549
by: Andy Jeffries | last post by:
Hi all, I want to write a function that given two elements will make their heights equal to the larger element. I've had a go at it and it works, but it makes both their heights larger than either of them (but equal) The code is as follows: var newheight = (second.offsetHeight > first.offsetHeight) ? second.offsetHeight :
8
6335
by: GTi | last post by:
I have a UI Class with StatusBarPanels Then I have another Class that is a thread. I want this class thread to update the StatusBarPanels in the UI class. But I get the error: error CS0120: An object reference is required for the nonstatic field, method, or property myNameSpace.MainForm.SetStatusBarText(string)' Please help a old C# newbie...
0
2129
by: Roman | last post by:
I'm trying to create the form which would allow data entry to the Client table, as well as modification and deletion of existing data rows. For some reason the DataGrid part of functionality stops working when I include data entry fields to the form: I click on Delete or Edit inside of DataGrid and get this error: "Error: Object doesn't support this property or method" If I remove data entry fields from the form - DataGrid allows to...
2
1403
by: Henri | last post by:
Hi! consider this : <div runat="server" id="mydiv" style="color:white;width:200px;" /> the styles contained in the style attributes are automatically parsed to the Style property. Is there a built-in method to import another string to the Style property. Some kind of:
3
1604
by: L.C. Rees | last post by:
Can custom __setattr__ methods and properties be mixed in new style classes? I experimented with a new style class with both a custom __setattr__ method and a property. Attributes controlled by the __setattr__ method work fine. When I attempt to set or get the property it raises the error: "TypeError: _settext() takes exactly two arguments (1 given)". This suggests that the __setattr__ may be conflicting with assignment to the property...
5
11700
by: John Dolinka | last post by:
I am trying to change a tooltip on an asp.net (framework 2) textbox with out a post back to the server. I can access many of the textbox properties and change them but not the tooltip. Below is a code snippet of javascript that works and the one tooltip "property" that does not. Any ideas?
9
1716
by: bonk | last post by:
Does anyone have a simple example on how to prohibit that any thread other than the current thread modifies a certain object (a collection) while we are in a certain section of the code? In other words: while we are inside this codeblock whoever might think of modified that particular collection has to wait until we have left that codeblock. As far as I understand it lock() {} only prohibits that other threads enter a certain block of...
0
8968
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8787
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9473
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
9334
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
9259
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
9208
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
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2744
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.