Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    Iran
    Posts
    695
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I made a dynamic radio button, but nothing happens when I click on it!

    Hi,

    Look at this script please:

    Code:
    <script>
    rdButt = document.createElement("input");
    rdButt.type = "radio";
    rdButt.name = "nothin";
    document.body.appendChild(rdButt);
    </script>
    I don't know what's wrong with it. I can see the radio button after running this script, but when I click on it, it doesn't get selected. I also tried to append it to a form ( I know that in NS a radio button should be inside a form or it doesn't function as you expect! ), but nothing changed.

    Thanks in advance

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Looks like a problem with IE. Works fine for me in Mozilla 1.2 and Opera 7

    Sorry, I don't know why. Maybe I'll crawl around MSDN a bit later and look.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmmmm

    According to this page the solution is as follows

    rdButt = document.createElement( '<input type="radio" name="nothin" />' );

    Stupid. I hope this is a bug and/or poor implementation and not the intended way of doing things, as it DOES NOT work in the other browsers.

    Looks like you'll need an IE-test conditional for now
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    Iran
    Posts
    695
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you beetle, you are a jewel in here!

    Well, I even tested that in NS7 and didn't work either. It looks stupid, yes, but thanks God that my program isn't fully dependent on it! So, I can simply forget about it for now! And it's so crappy if it can not update the elements array, think we should forget about dynamic radio buttons!


  •  

    Posting Permissions

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