Firstly, the line that renders "<h2>Hello <h4> name </h4>..." is not syntactically correct, it should be something like this:
Code:
document.write("<h2>Hello <h4> " + name + " </h4>, and welcome to my webpage.</h2>");
Secondly, you shouldn't have a block element
h4 nested inside
h2, you can use an
em tag instead of
h4. It italicize the textual content by default. So you should change the line in your JavaScript code to this:
Code:
document.write("<h2>Hello <em> " + name + " </em>, and welcome to my webpage.</h2>");
Lastly, if you want to change how the
em tag look, you can do this by adding some rules to your style sheet, as follows:
Code:
h2 em
{
color: Blue; /* make the text blue, this is just an example */
}
The code above applies the style to every single
em that sits under an
h2, so you might want to change it a little to suit your needs.