1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Dynamic input form field elements, works IE not FF

Discussion in 'JavaScript' started by WhatiFind, Jul 20, 2007.

  1. #1
    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 as put in in the box.

    The example works in internet explorer but not in firefox.

    Does anybody has experience to make this cross-browser compatible? Or does anybody has maby another example with doing this?

    Thanks in advance!
     
    WhatiFind, Jul 20, 2007 IP
  2. ds316

    ds316 Peon

    Messages:
    154
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I've updated the createForm function so it's a bit more standards friendly for you. (Works in IE + FF now)

    function createForm(number) {
    data = "";    
    inter = "'";
    if (number < 16 && number > -1) {
    for (i=1; i <= number; i++) {
    if (i < 10) spaces="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    else spaces="&nbsp;&nbsp;&nbsp;&nbsp;";
    data = data + "URL " + i + " :" + spaces
    + "<input type='text' size=10 name=" + inter
    + "url" + i + inter + "'><br>";
    }
    document.getElementById("cust").innerHTML = data;
    }
    else {
    window.alert("Please select up to 15 entries.");
       }
    }
    Code (markup):
     
    ds316, Jul 22, 2007 IP
    WhatiFind likes this.
  3. WhatiFind

    WhatiFind offline

    Messages:
    1,789
    Likes Received:
    257
    Best Answers:
    0
    Trophy Points:
    180
    #3
    Thanks! Appreciate your input :)
     
    WhatiFind, Jul 22, 2007 IP
  4. ds316

    ds316 Peon

    Messages:
    154
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    No problem mate!
     
    ds316, Jul 22, 2007 IP