Click to See Complete Forum and Search --> : Update DIV when typing in input field


jozomannen
March 6th, 2007, 04:28 AM
I have an input field, and when I type in it, I want a div to be updated at the same time.

I have a script that works this way, but I've just copied it, and it uses very much code. So I want a very simple one to work. Here's what I've got so far:

JavaScript:

function goCheck() {

var u_name = document.getElementById('username').value;

if (u_name!="") {

document.getElementById('output').innerHTML = "<h3>Please Wait, getting results....</h3>";

var url = 'test1.php';
var pars = 'output=normal&username='+u_name+'';

var myAjax = new Ajax.Updater( 'output', url, { method: 'get', parameters: pars, onlyLatestOfClass:"htmlfetcher" });

}

}


HTML:
<input type="text" id="username" size="25" onkeyup="goCheck();">

<span id="output"><h3><font color="#D55121" face="arial">The usename will be here</font></h3></span>

What should I do to make this work?

Thanks in advance

PeejAvery
March 6th, 2007, 08:32 AM
Take a look at this (http://www.w3schools.com/ajax/ajax_intro.asp). It explains it much simpler.

wilz04
April 9th, 2007, 01:28 PM
Where are the class "Ajax.Updater"??