SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic input form field elements, works IE not FF

    I've been looking for a javascript like this example: http://javascript.internet.com/forms/dynamic-input.html

    Here you can fill in (in this example) a number of URLS, then this script adds a number of fields on the HTML page.

    The example works from internet.com in internet-explorer but not in firefox.

    Does anybody has experience to create this javascript cross-browser compatible? Or does anybody has maby another examples by getting these functions.

    Thanks in advance!
    Get powerful links with dirSpace Web Directory

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this one:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <script type="text/javascript">
    function addF() {
    	var x = document.getElementById('fields');
    	var x1 = document.createElement('input');
    	var x2 = document.createElement('br');
    	x1.type = "text";
    	x.appendChild(x1);
    	x.appendChild(x2);
    }
    </script>
    </head>
    <body>
    <form id='fields' name='fields'>
    <input type="text" name="txt" id='txt'><br>
    </form>
    <input type="button" value="add" onclick="addF();">
    </body>
    </html>


Bookmarks

Posting Permissions

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