script HTML, HTML , , ( , script HTML, ). document.getElementById( "status" ), , null. , (null), , .
script HTML, JS :
var idPost
function updateVariables(){
idPost = document.getElementById("status").innerHTML;
}
HTML:
<body onload="updateVariables()">
onload, .
If you do not want the variable to be global, define it locally in the function you are trying to run, and make sure that the function is not called before the page is fully loaded.
source
share