Web WhizBang

Javascript Text Copier

This is a demonstration of how javascript can be used to manipulate text. It shows how you can get the browser to follow instructions when the user clicks on a button. The more javascript you know, the more complicated the instructions can get (such as comparing values and doing other kinds of tests), but the principles are the same.

Click in this box and type in a word:

Then click in this box and type in a word:

Then click this button:

The text you typed in the two boxes above are put together in this box:

Activities

Open this file (textcopy.html) in your text editor.
In the script, find the two quotation marks separated by a space. Type a word or two inside the set of quotation marks.
Save the file and reload it in your browser.

Open this file (textcopy.html) in your text editor.
Copy the entire INPUT tag whose name is copytextfrom2.
Move the cursor to the next line and copy the INPUT tag.
Change the name of the new INPUT tag to copytextfrom3.
Change the script so that the value in copyfromtext3 instead of the value in copytexfrom2 appears in copytotext.
Save the file and reload it in your browser.