0
function displayResult()
{
var  damn = document.getElementById("textyar").value;
document.getElementById("oneforty").innerHTML = damn;
var newDIV = document.createElement('div');
newDIV.className = "tweets";
var newspan =document.createElement('span');
newspan.className = "imagespanleft";
var img = document.createElement("IMG");
img.className="image";
img.src = "tweets/me.jpg";
newDIV.innerHTML = document.getElementById('textyar').value;  
document.getElementById('leftmaindiv').appendChild(newDIV).appendChild(newspan).appendChild(img); 
}

this is the code , i m trying to create an interface like twitter where u put in text box and tweet appears below in
problem is it is creating two divs instead of one , i tried insertbefore() as well but same behaviour
plz ask any questions if u r still not clear

Edited by learner guy: n/a

2
Contributors
2
Replies
5
Views
5 Years
Discussion Span
Last Post by learner guy
0

displayResult() seems OK. It creates one new div, <div class="tweets"> with some content, and puts it in leftmaindiv.

If two divs are created then it seems likely that displayResult() is called twice.

In other words the problem probably lies elsewhere, ie. wherever displayResult() is called.

Airshow

Edited by Airshow: n/a

0

thnx for reply , u r right the problem was with form i was calling it in , thnx again :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.