[Javascript] Adding more HTML to DIV with form

Peter Lauri lists at dwsasia.com
Tue Jun 13 07:48:51 CDT 2006


Thanks, I have a Toggle function written by my self, like to hard code when
I am learning a new "language" :) I will take the file size under
consideration, it is pretty important.

/Peter


-----Original Message-----
From: javascript-bounces at LaTech.edu [mailto:javascript-bounces at LaTech.edu]
On Behalf Of Nick Fitzsimons
Sent: Wednesday, June 14, 2006 12:47 AM
To: [JavaScript List]
Subject: Re: [Javascript] Adding more HTML to DIV with form

Peter Lauri wrote:
> Thank you for such a great answer. Can I create 10 different divs that
> contain the fields I need, and then just use the "style" to make is
visible
> or not? I would limit to maximum 10 files, but that is well enough in my
> case.
> 

Yes, that would be a good way to go. In addition, remember that 
uploading large files can take a while, so it's a good idea to limit the 
number a user can choose in one go.

For a quick and simple way to show and hide stuff, have a look at Dustin 
Diaz's toggle() function at:
<http://www.dustindiaz.com/top-ten-javascript/>
- scroll down to number 6. You'd call it with something like:

// show or hide the third input
toggle("myFileInput" + 3);

where your HTML would have a file input with id="myFileInput3".

Alternatively, you can split the toggle function into show() and hide() 
functions - just break out the two parts of the if...else..., setting 
display to "none" to hide and to "" (an empty string) to show. 
(Depending on any CSS you have applying to the inputs, you can replace 
the empty string with "block" or "inline" to match what's in the CSS.)

Cheers,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/


_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list