Results 1 to 1 of 1

Thread: How to create multiple instances using JS

  1. #1
    Join Date
    Oct 2009
    Posts
    11

    How to create multiple instances using JS

    Hi,

    I have written a code below:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <div id="emailRow" class="emailRowClass">
    <div><input type="checkbox" class="checkbox1"></div>
    <div><input type="text" class="textfield"></div>
    <div><input type="checkbox" class="checkbox2"></div>
    </div>

    <div id="emailAddressList" class="emailAddressClass"></div>

    <script type="text/javascript">
    function emailRowContent(isSelected, emailAddress, severity)
    {
    this.isSelected = isSelected;
    this.emailAddress = emailAddress;
    this.severity = severity;
    }

    var emailAddressListObj = document.getElementById('emailAddressList');
    var emailRowObj = document.getElementById('emailRow');
    var arrayOfEmails = new Array(5);

    for(i = 0; i < 5; i++)
    {
    arrayOfEmails[i] = new emailRowContent("checked", "fjkum@unknown.com", "");
    emailAddressListObj.insertBefore(arrayOfEmails[i],arrayOfEmails[i-1]);
    }
    </script>
    </body>
    </html>

    Basically, what I want to do is to dynamically create 5 instances of "emailRow" onto the web page making use of Javascript DOM. But have no success in getting it to work.

    Can anyone shed some light?

    Mike
    Last edited by webdeveloper; 26 Oct 2009 at 11:24 PM.

Similar Threads

  1. How To Create A Search Within Intranet
    By crashdummy06 in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 28 Aug 2007, 10:18 AM
  2. Multiple AJAX requests
    By Luis in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 07 Mar 2006, 09:36 PM

Posting Permissions

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