Since you just want to capture the value of the variable in any extension that opens in the notepad, I advise you to do this with javascript
.
In archive1 .js must have:
var x = 10;
var y = 20;
var z = 30;
And your page .html
, must have access to that file .js
. You get it like this:
<script src="arquivo1.js" ></script>
I left the assumption that it is in the same directory as your html.
Then just make your tags show the variables:
HTML
<p id="x"></p>
<p id="y"></p>
<p id="z"></p>
Javascript
document.getElementById("x").innerHTML = x;
document.getElementById("y").innerHTML = y;
document.getElementById("z").innerHTML = z;
If you want these values to be updated without the need to reload the page, with a range of 3s, as you said in the question, just add this to your javascript inside the html page:
Element.prototype.remove = function() {
this.parentElement.removeChild(this);
}
setInterval(function() {
var script = document.createElement("script");
script.src = "require.js";
document.getElementsByTagName("body")[0].insertBefore(script, document.getElementsByTagName("body")[0].childNodes[0]);
document.getElementsByTagName("script")[0].remove();
document.getElementById("x").innerHTML = x;
document.getElementById("y").innerHTML = y;
document.getElementById("z").innerHTML = z;
}, 3000)
Very good. Solved my problem. Thank you very much.
– Eric
Samir, you could help me with one more thing... when I use the <p id="z"></p> there’s a gap between the tags. I can’t take it out. would like to show [Value = id °C] are staying in separate lines.
– Eric
Use the same tag, put
document.getElementById("x").innerHTML = x + " °C";
. That was it?– Samir Braga
Blz... that’s right. Thank you.
– Eric