tags:

views:

39

answers:

2

Hi,

I wrote an ajax program.when i am getting response, at that time i will display that content in my web page using html tags.

So how can I use html tags in javascript?

+1  A: 

A sample data you get from server, and a sample html you want to add would make it easier for people to help you.

The basic steps are 1.Get a reference to the html node you want to put the new data in. There are multiple strategies to get reference to the node. If it has an id, it's most starightforward. 2.set innerHTML property.

eg

var node = document.getElementById("targetNode");
node.innerHTML = "<div>data</div>";
coolnalu
A: 

Well... Not much detail so not much of an answer...

Easy way

document.write("<body> <div> this is on my page! </div>  </body>

or you can edit the innerhtml of an element to place things inside it

document.getElementById("id").innerHTML = "<div>This is inside my element with id="id" </div>"

Answers the question, no?

Shaded