Hi Kumail,
see your corrected code below.
Why old one not working is ...
whenever used document.write in a window immediately
it's current contents(current page)wiped out!!!!!
in your loop first time u can read
"document.forms[0].elements[i].value" successfully,
after writing it to current document where will be
your old document???
it is over written by your new content so this
document only contains "asd"(in your case) no any
form, element.
so solution is extract all the required data before
writing (otherwise it will be overwritten by new one).
After finishing this u can proceed with writing.
I hope it is clear for u
any doubts sent back

--- Kumail Rizvi <[EMAIL PROTECTED]> wrote:
> Hi
>   I have problem in java script. Code is below.
>
> <html>
> <head><title></title>
> <script language="javascript">
> function check(){
> var i=0;
var s="";
> for(i=0;i<3;i++){
>//
document.write(document.forms[0].elements[i].value);
s=s+document.forms[0].elements[i].value
> }
document.write(s);
> }
> </script>
> </head>
> <body>
> <form name="abc" action="">
> <input type="checkbox" name="c0" value="asd">
> <input type="checkbox" name="c1" value="asd1">
> <input type="checkbox" name="c2" value="asd2">
> <input type="button" name="b" value"click"
> onclick="check()">
> </form>
> </body>
> </html>
>
> I want to pick all the names and values of check box
> in a loop.
> Wheather they r checked or not.
>
> This code gives me the only first elements value and
> name.
>
> Thankx in advance.
>
> Kumail Rizvi
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets


=====
-SaTyA-

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to