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
https://forums.phpfreaks.com/topic/173305-script-help-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.