Add the input text and display below

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yangtono
    New Member
    • Feb 2007
    • 10

    Add the input text and display below

    Hi,

    I'm trying to create a function that allows me to append the character at input text and display them on the div tag below. But the screen shouldn't refresh, therefore I'm using AJAX.

    But I can't seem to get it done, not really familiar with AJAX. Wonder if anyone here can help me out.
    Below is the code:

    Code:
    <HTML>
    <HEAD>
    <TITLE>Stock Count Task Generation</TITLE>
    <SCRIPT LANGUAGE='javascript1.2'>
    function addOwner(id, val) {
    		var objOutput = document.getElementById(id);
    		objOutput.innerHTML = val;
    }                                   
    </SCRIPT>
    
    </HEAD>
    <BODY>
    <FORM ACTION="WWW_WMS_SCNT.PROC_SCNT" METHOD="POST" name="form1">
    <TABLE >
    <TR>
    <TD>
    <INPUT TYPE="text" NAME="in_owner_code2" id="test1" class="defaultText" SIZE="10" MAXLENGTH="10" onFocus="window.status='Select the Owner Code'; return true;" onBlur="window.status=''; return true;">
    <INPUT TYPE="button" VALUE="Add" class="smallButton" onClick="addOwner(in_owner_code_range,this.form.in_owner_code2.value);" name="owner_code_range_add">
    </TD>
    </TR>
    <TR>
    <TD>
    <DIV ID="in_owner_code_range"></DIV>
    </TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Firstly, this is not Ajax, just simple DHTML.

    The mistake in your code is that the id should be a string:
    [HTML]<INPUT TYPE="button" VALUE="Add" class="smallBut ton" onClick="addOwn er('in_owner_co de_range',this. form.in_owner_c ode2.value);" name="owner_cod e_range_add">[/HTML]

    Comment

    • yangtono
      New Member
      • Feb 2007
      • 10

      #3
      Originally posted by acoder
      Firstly, this is not Ajax, just simple DHTML.

      The mistake in your code is that the id should be a string:
      [HTML]<INPUT TYPE="button" VALUE="Add" class="smallBut ton" onClick="addOwn er('in_owner_co de_range',this. form.in_owner_c ode2.value);" name="owner_cod e_range_add">[/HTML]

      Thanks for your help.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        You're welcome (even though I replied after, what, 10 months!) ;)

        Comment

        Working...