PDA

View Full Version : Ajax and div...



Hitman
01-11-2009, 02:46 PM
Hi, I've got this code:


function setOutput(){

if(httpObject.readyState == 4){

document.getElementById('whatever').value = httpObject.responseText;

}



}

The whole script is getting something, basically, and putting it onto the page... but it only puts it in an input box, not a div.

For example, it shows what I want with


<input id="whatever" />

But with


<div id="whatever"></div>

it does nothing... I'm a newbie with javascript so if anybody could help... thanks.

Tomm
01-11-2009, 05:20 PM
Use .innerHTML not .value for divs.

Hitman
01-11-2009, 05:25 PM
Use .innerHTML not .value for divs.
Smashing, it works now. Thanks!

Want to hide these adverts? Register an account for free!