Hi everybody!
I am weak in javascript. Can anybody help me.
I need to make script which takes from one field string(numbers separated by space copied from excel) divide it by space into variables and insert into another fields on this page.

Recommended Answers

post whatever work u have done so far

Jump to Post

All 4 Replies

post whatever work u have done so far

ok wait

<textarea name="receiver1" id="receiver1"></textarea> <br>
<input type="text" name="receiver2" value="" />           <br>
<input type="text" name="receiver3" value="" />               <br>
<input type="text" name="receiver4" value="" />                   <br>
<input type="text" name="receiver5" value="" />   <br>
<input type="text" name="receiver6" value="" />           <br>
<input type="text" name="receiver7" value="" />               <br>
<input type="text" name="receiver8" value="" />                   <br>
<input type="text" name="receiver9" value="" />
<br>
<input type="text" name="donator" value="" size="80" /><br>

in the donator input field I enter such formatted string

1   1   2.3 5.9 27.14   12.213  14.927  16.284  18.998  21.712

and I need them to be inserted into above fields. Additionally numbers thirth and forth must be formatted as (2.3cmx5.9cm) and inserted into textarea. Not easy right?

<button onclick='distribute();'>DO</button>
<script type="text/javascript">
function distribute(){
var all=document.getElementsByName("donator");
var allvalues=all.value;
here I need to divide string by spaces into separate parts and insert them into fields above
}
</script>
Member Avatar
//this will give you an array of values that were split by spaces
var arrValues = all.split(' ');
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.