Changing webpage color background

Hi Xojo colleagues,
I use this Michel’s code found in the forum

dim colour as string = "0,0,255" self.ExecuteJavaScript("var x=document.getElementById('"+self.ControlID+"'); x.style.backgroundColor= ""rgb(" + colour + ")""")

but putting it in a webpage container’s button, it does not change anything.
Didi I do somewhere wrong?
Regards
MB

Well… It works here in the Action event of a WebButton.

What is unclear here is what you say about “in a webpage container’s button”.

If you placed the button on a WebContainer, then self is the container, not the webpage. So it works, but only as background of the webContainer.

Thanks for the clarification.
I have the sense that neither webcontainer background color changed but i will cjeck again.
I thought that me is related to control and self with the form where the control on it. So in order to access the webform where the container is on it i have to use self.parent. ControlID?

[quote=428972:@Michael Batakis]dim colour as string = “0,0,255”
self.ExecuteJavaScript(“var x=document.getElementById(’”+self.parent.ControlID+"’); x.style.backgroundColor= ““rgb(” + colour + “)””")[/quote]

That’s it :slight_smile: