Skip to content

Instantly share code, notes, and snippets.

@dgbrahle
Created July 7, 2010 18:16

Revisions

  1. @invalid-email-address Anonymous created this gist Jul 7, 2010.
    57 changes: 57 additions & 0 deletions JS
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
    <html>
    <head>
    <script language="javascript" type="text/javascript">

    function showanswer()
    {
    if (!document.html)
    return
    document.html.num_answers.src=
    document.answerMC.num_ans.options[document.answerMC.num_ans.selectedIndex].value
    }


    function insertABunchOfElements(){
    var txt = "Dave";
    var newtext = document.createTextNode(txt);
    document.body.appendChild(newtext);
    }


    function insertABunchOfFields(){

    var answerCount = //whatever the user has selected from the dropdown

    for(i=0; i<=5; i++)

    {
    var li = document.createElement("li");
    var input = document.createElement("input");
    input.id = i;
    input.name = i;
    input.type = "text";
    li.appendChild(input);
    field_area.appendChild(li);
    }



    </script>


    </head>

    <body>
    <select onchange="insertABunchOfElements();">
    <option selected value="Click">Click</option>
    <option value="Test">Test</option>
    <option value="13">13</option>


    </select>
    </body>



    </html>