Re: [SLUG] Javascript Problem

From: Jason Boxman (jasonb@edseek.com)
Date: Sun Oct 15 2006 - 22:20:51 EDT


On Sunday 15 October 2006 22:03, Daniel Jarboe wrote:
> Ruby on Rails is way overkill for this... this is pretty basic client-side
> javascript functionality

I wasn't suggesting Rails, but rather Prototype.

> quick and dirty version below, season to taste
>
> <script type="text/javascript">
> function update(source)
> { var i,number,temp=""
> // valid number, no-decimal
> if ( !isNaN(source.value) && (source.value.indexOf(".")==-1) &&
> // assign value to number and test greater than 0
> (number=parseInt(source.value,10))>0 )
> { for (i=0;i<number;i++)
> temp+="<input type='text' name='value"+i+"'><br>"
> document.getElementById("updateMe").innerHTML=temp
> }
> else
> alert("Error: Positive integer required")
> }
> </script>
> <form>
> How many? <input type=text onchange="update(this)">
> <div id="updateMe">
> </div>
> </form>

-- 

Jason Boxman http://edseek.com/ - Linux and FOSS stuff

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:59:39 EDT