locked
How do I use a variable in HTML... RRS feed

  • Question

  • I am going crazy.  Such a simple problem but I can't seem to find an answer after searching all day, even on the HTML/Java/CSS web sites.

    I have the basic "101" code here... 

    <!DOCTYPE html>
    <html>
    <body>

    <h1>My First Heading</h1>  

    <p>My first paragraph.</p>  

    </body>
    </html>

    I want to set 2 variables:

    var Header1 = "New Cars"

    var Paragraph1 = "Ford"

    Question:

    Would like to set <h1>My First Heading</h1> to <h1>the variable Header1</h1>

    and <p>My first paragraph.</p> to <p>the variable Paragraph1</p>  

    The reason is that I am reading in a data item from a table and need to set "<h1>" and "<p>" to these variables.  Oh my, why is life so complicated or I guess I am just stupid...

    But thank you anyone that answers... 

    Edward at

    enpiccoli@msn.com


    Edward Piccoli

    Sunday, July 27, 2014 9:44 PM

Answers

All replies