Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<TD> in NS 4.76 using JS

Status
Not open for further replies.

Desperados

IS-IT--Management
Feb 13, 2002
13
IT
hi,

I need to change the bgimage applied to a <TD> when i click on a link inside the cell... is that possible?
_______________________
| |
| LINK <-|--- Bgimage
|_______________________|

I solved the problem in IE4+ and NS6 with the following instruction:

document.getElementById(&quot;Back&quot;+i).setAttribute(&quot;background&quot;,&quot;images/menu_on_bg.gif&quot;);

where 'i' is the number of the <TD> being clicked.

But i can't find the right sintax for NS4.76...
tnx.
 
Unfortunately, you won't find the right syntax because N4 doesn't support getElementById().
You cannot change background image of a table cell dynamically in N4.
 
tnx... but there's no tricks that i can use for?
 
Hi

Iam not sure whether this works but give it a shot. Try this onclick syntax for your link inside td.
<a href=&quot;#&quot; onclick=&quot;javascript:parentNode.src='whateversourceuwant.jpg';&quot;></a>

Again iam not sure whether parentNode is supported in netscape4.Give it a shot and let me know. Badrinath Chebbi
 
no... doesn't work... but tnx anyway...
My problem is a bit different i need to change not only the bg of that TD, i need to change other 4 TD related... i try to explain with an example:
______ ______ ______ ______
|bgimgA|bgimgB|bgimgB|bgimgB|
| LINK 1 | LINK 2 | LINK 3| LINK 4|
|______|______|______|______|
^
|
selected link

______ ______ ______ ______
|bgimgB|bgimgA|bgimgB|bgimgB|
| LINK 1 | LINK 2 | LINK 3| LINK 4|
|______|______|______|______|
^
|
selected link
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top