Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] javascript question. please help


  • From: javascript@xxxxxxxxxx (Heidi Castillo)
  • Subject: [Javascript] javascript question. please help
  • Date: Thu, 27 Feb 2003 11:37:31 -0800 (PST)

--0-1452502287-1046374651=:4822
Content-Type: text/plain; charset=us-ascii


I need to know who to split a form into to arrays.  can you help?

 

<html>
<head>
<script language=javascript>
function farmcount()
{

var s=document.farmform;
var fn= new Array(9);
var fc= new Array(9);

 for(i=0; i<20; i++)
 {
 loc=i/2;
 fn(loc)=s.elements[i].value;
 }
 document.write(fn(loc));

 

}
</script>
</head>

<body>
<center>
<form name="farmform">

<input type="text" size="20" value="Cows">
<input type="text" size="4" value="77"><p>
<input type="text" size="20" value="Sheep">
<input type="text" size="4" value="120"><p>
<input type="text" size="20" value="Goats">
<input type="text" size="4" value="3"><p>
<input type="text" size="20" value="Pigs">
<input type="text" size="4" value="3"><p>
<input type="text" size="20" value="Horses">
<input type="text" size="4" value="3"><p>
<input type="text" size="20" value="Mules">
<input type="text" size="4" value="17"><p>
<input type="text" size="20" value="Chickens">
<input type="text" size="4" value="43"><p>
<input type="text" size="20" value="Ducks">
<input type="text" size="4" value="120"><p>
<input type="text" size="20" value="Raptors">
<input type="text" size="4" value="7"><p>


<input type="button" value="GO" onClick="farmcount()">
</form>
</center>
</body>
</htnl>



---------------------------------
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, and more
--0-1452502287-1046374651=:4822
Content-Type: text/html; charset=us-ascii

<P>I need to know who to split a form into to arrays.&nbsp; can you help?</P>
<P>&nbsp;</P>
<P>&lt;html&gt;<BR>&lt;head&gt;<BR>&lt;script language=javascript&gt;<BR>function farmcount()<BR>{</P>
<P>var s=document.farmform;<BR>var fn= new Array(9);<BR>var fc= new Array(9);</P>
<P>&nbsp;for(i=0; i&lt;20; i++)<BR>&nbsp;{<BR>&nbsp;loc=i/2;<BR>&nbsp;fn(loc)=s.elements[i].value;<BR>&nbsp;}<BR>&nbsp;document.write(fn(loc));</P>
<P>&nbsp;</P>
<P>}<BR>&lt;/script&gt;<BR>&lt;/head&gt;</P>
<P>&lt;body&gt;<BR>&lt;center&gt;<BR>&lt;form name="farmform"&gt;</P>
<P>&lt;input type="text" size="20" value="Cows"&gt;<BR>&lt;input type="text" size="4" value="77"&gt;&lt;p&gt;<BR>&lt;input type="text" size="20" value="Sheep"&gt;<BR>&lt;input type="text" size="4" value="120"&gt;&lt;p&gt;<BR>&lt;input type="text" size="20" value="Goats"&gt;<BR>&lt;input type="text" size="4" value="3"&gt;&lt;p&gt;<BR>&lt;input type="text" size="20" value="Pigs"&gt;<BR>&lt;input type="text" size="4" value="3"&gt;&lt;p&gt;<BR>&lt;input type="text" size="20" value="Horses"&gt;<BR>&lt;input type="text" size="4" value="3"&gt;&lt;p&gt;<BR>&lt;input type="text" size="20" value="Mules"&gt;<BR>&lt;input type="text" size="4" value="17"&gt;&lt;p&gt;<BR>&lt;input type="text" size="20" value="Chickens"&gt;<BR>&lt;input type="text" size="4" value="43"&gt;&lt;p&gt;<BR>&lt;input type="text" size="20" value="Ducks"&gt;<BR>&lt;input type="text" size="4" value="120"&gt;&lt;p&gt;<BR>&lt;input type="text" size="20" value="Raptors"&gt;<BR>&lt;input type="text" size="4" value="7"&gt;&lt;p&gt;</P>
<P><BR>&lt;input type="button" value="GO" onClick="farmcount()"&gt;<BR>&lt;/form&gt;<BR>&lt;/center&gt;<BR>&lt;/body&gt;<BR>&lt;/htnl&gt;</P><p><br><hr size=1>Do you Yahoo!?<br>
<a href="http://rd.yahoo.com/finance/mailtagline/*http://taxes.yahoo.com/";>Yahoo! Tax Center</a> - forms, calculators, tips, and more
--0-1452502287-1046374651=:4822--