www.webdeveloper.com
Results 1 to 2 of 2

Thread: JavaScript Forms

  1. #1
    Join Date
    Jan 2012
    Location
    Dallas
    Posts
    7

    JavaScript Forms

    Is there a way to concatenate two for loops? Is it even possible?

    My code is below...Thank you in advance.

    <html>
    <head>
    <title>String Loop</title>
    <script type="text/javascript">

    var name=new Array(20);

    for (i=0;i<=20;i++)
    {
    name[i]= prompt("what is your name?");
    }

    for (i=0;i<=20;i++)
    {
    document.write(name[i]+ " " + name[i].length +'<BR>');
    }

    </script>

    </body>
    </html>

  2. #2
    Join Date
    Feb 2012
    Posts
    218
    Why don't you just
    Code:
    for (var i=0;i<=20;i++)
    {
    	name[i]= prompt("what is your name?");
    	document.write(name[i]+ " " + name[i].length +'<BR>');
    }
    ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles