Hi to all, I'm new in the forum and also new in the JavaScript programing.
I have the following problem, I have a table that has another table inside one of its elements, the inside table is affected with one property that is in a CSS file. I hope I explain it OK(here is a piece of the code).

<body>
<table bgcolor="#000000">
<tr>
 <td valign='top' id='test'>
	<table width='100%' border='0' cellspacing='0' cellpadding='0'>        
		<tr valign='middle'>
		<td>
			<div>This is some text</div>
		</td>
		</tr>
	</table>
</td>
</tr>
</table>

My problem: I need to take the name of the property that is affecting the inside table, I don't know the name of the property(here in the example is 'test'), I need to provide a solution that is dynamic, the name of the property is no always the same(not always 'test').
I was thinking in a solution but I get stuck, I was thinking to take the property of the parent of the object, but also I don't know how many parents my objects has.
I hope you can help me, and I hope I explain my problem OK

Recommended Answers

All 2 Replies

hi
plz use right word, coz i m not able to understand u'r problem. here 'test' is not property it is a value of property of td, i.e. id.
so id is an attribute. and for that particular td it has got the value 'test', to set other attribute for that tag u can use
element.setAttribute('attribute_name','value');
function of dom.

if u want to change the style dynamically use function, for ex. font:
element.style.font="value";
or for text-align,
element.style.textAlign="value";

using this u can change style dynamically.

-- to find parent node use
var oParentNode= element.getParentNode();

i hope this info will help u..

Just stick another id on the item you actually want to affect.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.