Update DIV when typing in input field
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Update DIV when typing in input field

  1. #1
    Join Date
    Aug 2005
    Posts
    6

    Update DIV when typing in input field

    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:

    Code:
    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:
    Code:
    <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

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,879

    Re: Update DIV when typing in input field

    Take a look at this. It explains it much simpler.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Mar 2007
    Posts
    13

    Re: Update DIV when typing in input field

    Where are the class "Ajax.Updater"??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center