Getting font size in JavaScript

I am trying to get the font size in a label in JavaScript, but the information does not seem to be available for it to find it.

self.ExecuteJavaScript("var fsize = [x.innerHTML] ;") // <div style="position: absolute; left: 0px; right: 0px; top: 50%; overflow: hidden; margin-top: -7px; height: 15px; max-height: 15px;" class=""> 'self.ExecuteJavaScript("var cars = [x.style.fontSize] ;") self.ExecuteJavaScript("Xojo.triggerServerEvent('" + myHTMLArea1.ControlID + "','LinkClicked', fsize)")

I have tried to set the font size of a label to 26 but this trigger the server event, but then I get an error out of bound.

Looking at the DOM with the developer console of Chrome, 26 appears nowhere.

I just did a test on a traditional web page. Here also, oddly, I do not get the information in javascript, except if this information has been put in javascript.

var t = document.getElementById (‘bananeAvecLaPeau’);
t.style.color;

-> Result: “”

t.style.color = ‘green’
t.style.color;

-> Result: ‘green’

same for fontSize, etc.

(tested in Chrome console and Firefox console)

[quote=182333:@olivier vidal]I just did a test on a traditional web page. Here also, oddly, I do not get the information in javascript, except if this information has been put in javascript.

var t = document.getElementById (‘bananeAvecLaPeau’);
t.style.color;

-> Result: “”

t.style.color = ‘green’
t.style.color;

-> Result: ‘green’

same for fontSize, etc.

(tested in Chrome console and Firefox console)[/quote]

Thank you for checking Olivier. I am reassured.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.