[clug-progsig] Javascript how to write to a <textarea>
Doug Boyd
douglasboyd at shaw.ca
Wed Feb 9 08:31:09 PST 2005
That did it. Thanks for taking a look and for the tip.
Cheers,
Doug
> first, change the submit button into a regular button, and second, move the
> onsubmit event handler to the onclick event handler of the button. for
> example:
>
> <form name="myoutput">
> Enter total number of disks
> <input type="text" name="totaldisks" size="10">
> <input type="button" value="Solve"
> onclick="solve(document.myoutput.totaldisks.value,1,3,2)"/>
> <br /><br /><br />
> <textarea name="box" id="box" cols="30" rows="10">Solution presented
> here. </textarea>
> </form>
>
> by using a submit button the browser was submitting the form back to the
> page itself, which results in a reset of the page as though you had hit the
> refresh button.
>
> one thing trick/tip that I'll mention that has nothing to do with your
> question is the call to solve uses document.myoutput.totaldisk.value, but
> you could also use this.form.totaldisk.value, where "this" refers to the
> button being clicked, and "this.form" refers to the form of the button
> being clicked. I like to use this.form because it's a more encapsulated.
>
> Dave
More information about the clug-progsig
mailing list