Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > RocketCake
help with html javascript please

therickman
Registered User
Quote
2020-01-29 19:05:00

Hi ,
I bought rocketcake during the new year's sale and I like it so far!
I need help with this please :
I have buttons placed above an image , and a table below the image;
When the user clicks on a button, I want to highlight the content of a table cell , or select it or change the cell color, whichever would be possible in rocketcake

I searched about javascript ; so far I have managed, via this function " {document.getElementById} to change the color of the button that is clicked , but not the cell content.
The "id" of the button is recognized ( I found the "id" in the html code ) , but the "id" of the table cell isn't apparently...

I need to somehow "connect" the button to the cell maybe for this to work , but I don't know how to do that.
Thanks for your help ! eric


erik
Registered User
Quote
2020-01-30 08:09:02

I'm not sure if that is so easily possible, table cells don't have ids in RocketCake unfortunately (having an id for each cell would clutter the source, I guess).

BUT: you can access this using cell and row index. This code would make the background of row 2 cell 3 red:

var table = document.getElementById("yourTableID");
table.rows[2].cells[3].style.backgroundColor= 'red';


Be sure to replace 'yourTableID' with the actual id of your table.


therickman
Registered User
Quote
2020-01-30 12:23:11

Hello Erik ,
thanks a lot , your solution WORKS !
I'll try to figure out on my own how to revert a highlighted cell back to standard ( white) background color when I click on another cell so only one cell is "highlighted" at a time.

Thanks again !
eric


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Intern?tional" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact