View Single Post
Old 02-11-2013, 08:50 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,560
Thanks: 62
Thanked 4,056 Times in 4,025 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Code:
<input type = "button" id = "btn" value= "Add Student Data" onclick="getData(this.form)">
...
<script type="text/javascript">
function getData( form )
{
    var temp = [ form.name.value, form.mark1.value, form.mark2.value,
                 form.mark3.value, form.mark4.value ];
    var stringData = temp.join( "\n" );
    // ... but what you will do with it now you don't say ...
    // as a PURE GUESS:
    form.resultdata.value = stringData;
}
</script>
You may temp.join( ) on whatever kind of separator(s) you want.

You could even produce CSV data thus:
Code:
    var stringData = '"' + temp.join( '","' ) + '"';
Hard to guess what you really want from such vague specifications.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.

Last edited by Old Pedant; 02-11-2013 at 08:52 PM..
Old Pedant is online now   Reply With Quote
Users who have thanked Old Pedant for this post:
trancecommunity (02-13-2013)