Need Some Assistance...

Discussion in 'HTML & Website Design' started by Web-Talks, Dec 6, 2009.

  1. #1
    Does anyone know how to have a field where you can enter letters/numbers and with press of a button, it will update all other fields.

    I am probably not making any sense. Let's take this site for example, that is similar to what I am looking for. On that site you can enter your Twitter username on press go, it will update all other fields for you.

    Anyone know the script or code to get this working?

    Thanks
     
    Web-Talks, Dec 6, 2009 IP
  2. myst_dg

    myst_dg Active Member

    Messages:
    224
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Use javascript to get the value of the input field, and simply print the value on the screen when the button is clicked.
     
    myst_dg, Dec 6, 2009 IP
  3. Web-Talks

    Web-Talks Active Member

    Messages:
    484
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #3
    I don't understand what your trying to say.

    How do i get javascript to get the value of the input field?
     
    Web-Talks, Dec 6, 2009 IP
  4. myst_dg

    myst_dg Active Member

    Messages:
    224
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #4
    The code looks a bit ugly, anyway, hopes it's helpful for you to get a clue.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    	<title>whatever</title>
    	<script type="text/javascript">
    		function print() {
    			var input = document.getElementById('yourinputfield').value;
    			document.getElementById('youroutputfield').innerHTML = input;
    		}
    	</script>
    </head>
    <body>
    	<form action="#" onsubmit="print(); return false;">
    		<p>
    			<input id="yourinputfield" type="text" />
    			<input type="submit" value="submit" />
    		</p>
    	</form>
    	<p>
    		<textarea rows="3" cols="50%" id="youroutputfield"></textarea>
    	</p>
    </body>
    </html>
    Code (markup):
     
    myst_dg, Dec 7, 2009 IP