I'm an old school RPGILE programmer trying to create a website. How do I get .innerHTML
working from a PHP file (with HTML embed) to change an HTML element text?
My PHP (file) code:
$txt = 'First Name is required!';
sInnerHtml($reginfo, $txt);
// $reginfo is the name of the HTML element
sInnerHtml
points to a (PHP file) service function:
function sInnerHtml($element, $text)
{
echo <<<_END
<script>
jO("$element").innerHTML = "$text"
</script>
_END;
}
jO
points to a JavaScript alias:
function jO(obj)
{
if(typeof obj === 'object')
return obj
else
return document.getElementById(obj)
}