Jump to content

How can I insert a line to the top of the <body>?


Betty_S

Recommended Posts

Perhaps something like this:

<html><body><div>Some Content</div><script>var h1 = document.createElement("h1");var a = document.createElement("a");a.href = "blablabla";a.appendChild(document.createTextNode("blablabla"));h1.appendChild(a);document.body.insertBefore(h1, document.body.firstChild);</script></body></html>

Check out the XML DOM Tutorial for more info.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...