html after javascript function - why it doesn't work?

Discussion in 'Javascript' started by Leszek, Dec 26, 2005.

  1. Leszek

    Leszek Guest

    I' got a problem with a web site i wrote a javascript:

    function zmiana(ile){
    while(document.getElementById('accomp').childNodes.length>3){
    ostatni=document.getElementById('accomp').lastChild;
    document.getElementById('accomp').removeChild(ostatni);
    }
    for (i=1;i<=ile;i++){
    pole=document.createElement("BR");
    document.getElementById('accomp').appendChild(pole);

    var a=document.createTextNode("Name of accompanying person #"+i+" ")
    document.getElementById('accomp').appendChild(a);

    accomp.style.fontWeight='bold';

    pole=document.createElement("input");
    pole.type = "text";
    pole.size="50";
    pole.id="$name"+i;
    pole.name="$name"+i;
    document.getElementById('accomp').appendChild(pole);
    }
    }

    and here is a form that using this function:


    <form name="accomp">
    Number of accompanying persons:
    <select name="accperson" onChange="zmiana(this.value)">
    <?php
    $accperson=0;
    echo "<option value=\"$accperson\" selected >$accperson</option> \n";
    for ($accperson=1;$accperson<=5;$accperson++){
    echo "<option value=\"$accperson\">$accperson </option>\n";
    }
    ?>
    </form>
    After this form i've got a few lines of html (just writing some things on
    the screen)

    Now, the problem is that nothing what is after this form is never done. And
    i don't know why
    Why is this happening?

    Thanks for any ideas

    Leszek
    Leszek, Dec 26, 2005
    #1
    1. Advertising

  2. Leszek

    Guest

    Leszek wrote:
    > I' got a problem with a web site i wrote a javascript:
    > <select name="accperson" onChange="zmiana(this.value)">
    > for ($accperson=1;$accperson<=5;$accperson++){
    > echo "<option value=\"$accperson\">$accperson </option>\n";
    > </form>
    > After this form i've got a few lines of html (just writing some things on
    > the screen)
    >
    > Now, the problem is that nothing what is after this form is never done. And
    > i don't know why
    > Why is this happening?



    What about </select> ?
    , Dec 26, 2005
    #2
    1. Advertising

  3. Leszek

    Leszek Guest

    Yes !!!
    Thanks i forgot about it

    Leszek
    Leszek, Dec 26, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Lane
    Replies:
    4
    Views:
    11,214
    Chris Lane
    Nov 17, 2003
  2. Horace Nunley

    why why why does function not work

    Horace Nunley, Sep 27, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    455
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Sep 27, 2006
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    874
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,803
    Smokey Grindel
    Dec 2, 2006
  5. ryles
    Replies:
    3
    Views:
    529
    Piet van Oostrum
    Jul 26, 2009
Loading...

Share This Page