Jump to content

Script help please


wagga2650

Recommended Posts

I have a javascript that copies from an input field straight to the page. Currently it only works on text boxes but I was wondering if anyone can get it to work with a radio box and check box.

Just input data in the first field then click on the page and you will see it work.

 

Here is the script

 

 

This is the contents of a external file called copydata.js

 

function copyData(el) {
  document.getElementById('copy_' + el.id).innerHTML = el.value;
}

 

 

This goes in the head section

 

<script type="text/javascript" src="copydata.js"></script>

 

and this is the body section it has 2 parts on is the input and the other is where it places the data

 

Part 1

Name: <input type="text" name="name" style="width:250px; font-family: Verdana; font-size: 11px" id="name" onchange="copyData(this);">

 

Part 2

<b>Name: </b>
<br>
<TEXTAREA name="name" COLS=30 ROWS=1 id="copy_name" style="border: none; border-color: black; background-color: white; overflow: auto; font-family: Verdana; font-size: 11px" readonly="readonly"></TEXTAREA>

 

Thanks in advance

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.