Answers for "access javascript variable in html"

0

html call variable javascript

<!DOCTYPE html>
<html>
    <body>
        <!--\|/id here-->
        <p id="myText"></p>
        <p id="myTextTag"></p>
        <script>
            <!--Here we retrieve the text and show what we want to write...
            var text = document.getElementById("myText");
            var tag = document.getElementById("myTextTag");
            var toWrite = "Hello"
            var toWriteTag = "<a href='https://stackoverflow.com'>Stack Overflow</a>"
            <!--...and here we are actually affecting the text.-->
            text.innerHTML = toWrite
            tag.innerHTML = toWriteTag
        </script>
    <body>
<html>
Posted by: Guest on September-15-2021
-2

js variable html

<div onload="document.innerHTML(name + ' is ' + age)">
Posted by: Guest on April-14-2020

Code answers related to "access javascript variable in html"

Browse Popular Code Answers by Language