D
DP
I've just spent my day today trying to learn javascript for the first
time, so the answer to this may seem obvious to some - but it's got me
stumped.
I want to be able to copy a column from an Excel spreadsheet and paste
it into a webpage form, and have an array that I can manipulate.
Maybe I'm missing a much better way to do this, but I've been thinking
I need to use a textarea form, and split() the result into the array.
My problem is that I can't seem to split() based on the hard-returns
in the inputed text.
Below is a simple example.
If I enter the following, I get the results that I want (because it's
split() on the spaces):
AbC dEf GhI
But if I enter the data the way I want to be able to, as follows, I
can't find a way to make it work:
AbC
dEf
GhI
Am I missing the obvious, or what??
Thanks,
DH
*******************
<html>
<head>
<script type='text/javascript'>
function makeupper(elem){
var mySplitResult = elem.value.split(" ");
for(i=0; i<mySplitResult.length; i++){
document.write(mySplitResult + "<br/>");
document.write(mySplitResult.toUpperCase() + "<br/>");
}
}
</script>
</head>
<body>
<form>
Enter Stuff:
<textarea name="txt" wrap="PHYSICAL" id="partnum"></textarea>
<input name="Button" type='button'
onclick="makeupper(document.getElementById('partnum'))"
value='Get-R-Done' />
</form>
</head>
<body>
time, so the answer to this may seem obvious to some - but it's got me
stumped.
I want to be able to copy a column from an Excel spreadsheet and paste
it into a webpage form, and have an array that I can manipulate.
Maybe I'm missing a much better way to do this, but I've been thinking
I need to use a textarea form, and split() the result into the array.
My problem is that I can't seem to split() based on the hard-returns
in the inputed text.
Below is a simple example.
If I enter the following, I get the results that I want (because it's
split() on the spaces):
AbC dEf GhI
But if I enter the data the way I want to be able to, as follows, I
can't find a way to make it work:
AbC
dEf
GhI
Am I missing the obvious, or what??
Thanks,
DH
*******************
<html>
<head>
<script type='text/javascript'>
function makeupper(elem){
var mySplitResult = elem.value.split(" ");
for(i=0; i<mySplitResult.length; i++){
document.write(mySplitResult + "<br/>");
document.write(mySplitResult.toUpperCase() + "<br/>");
}
}
</script>
</head>
<body>
<form>
Enter Stuff:
<textarea name="txt" wrap="PHYSICAL" id="partnum"></textarea>
<input name="Button" type='button'
onclick="makeupper(document.getElementById('partnum'))"
value='Get-R-Done' />
</form>
</head>
<body>