Help with dynamically creating radio buttons and general formatting

Author Message
scooble

  • Total Posts : 11
  • Scores: 0
  • Reward points : 0
  • Joined: 12/5/2010
  • Status: offline
Help with dynamically creating radio buttons and general formatting Tuesday, February 07, 2012 3:25 AM (permalink)
0
I tried using the search function, but the hour glass just stated as an hour glass for an hour so I gave up - sorry

So here is my problem,
I am trying to dynamically create radio buttons, using the function
Set MyRadio = CreateElement("input") 
 With MyRadio 
 .id = "ParentNodeKey" 
 Call .setAttribute("type", "radio") ' PR - The setAttribute() method adds a new attribute.  
 Call .setAttribute("name", "ParentNodeKey")             
 Call .setAttribute("value", CurNodeType.key)              
 End With 
 



However, the code does not write the name attribute to the 'MyRadio', thus, the code is useless and unclickable.
If I Manually write within the input tag of the HTML code
name="ParentNodeKey"

Then the radio buttons become clickable

Therefore, how do I dynamically create radio buttons in VBS?

Thanks,
Tricia

<message edited by scooble on Tuesday, February 07, 2012 4:02 AM>
 
#1
    59cobalt

    • Total Posts : 972
    • Scores: 91
    • Reward points : 0
    • Joined: 7/17/2011
    • Status: online
    Re:Help with dynamically creating radio buttons and general formatting Tuesday, February 07, 2012 10:00 AM (permalink)
    0
    I don't have much experience with this, but perhaps you should try
    .name = "ParentNodeKey"
    instead of
    Call .setAttribute("name", "ParentNodeKey")

     
    #2
      scooble

      • Total Posts : 11
      • Scores: 0
      • Reward points : 0
      • Joined: 12/5/2010
      • Status: offline
      Re:Help with dynamically creating radio buttons and general formatting Tuesday, February 07, 2012 9:06 PM (permalink)
      0
      thanks for the help, but unfortunately, that didn't work either.
      There must be a way of dynamically generating Radio buttons though
       
      #3
        59cobalt

        • Total Posts : 972
        • Scores: 91
        • Reward points : 0
        • Joined: 7/17/2011
        • Status: online
        Re:Help with dynamically creating radio buttons and general formatting Wednesday, February 08, 2012 8:49 AM (permalink)
        0
        The following should work:
        Set MyRadio = document.CreateElement("input") 
        With MyRadio
         .id   = "ParentNodeKey"
         .type = "radio"
         .name = "ParentNodeKey"
         .value = CurNodeType.key
        End With
        However, it will merely create the element. You still need to insert it somewhere in the DOM tree:
        Set MyParent = document.GetElementById("foo")
        MyParent.appendChild(MyRadio)

        If this doesn't work, you need to provide more information (error code & message, context of your code snippet, ...).
         
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9