#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Chennai
    Posts
    160
    Rep Power
    11

    how to add radio button from javascript


    i want to know how do i add radio button in a div tag.it will be dynamically created

    window.opener.newDiv.innerHTML = window.opener.newDiv.innerHTML + "<input type=radio name=radio>";

    is that something like this??????????????

    please help me yaar
  2. #2

  3. Join Date
    Jun 2003
    Location
    Watford, UK
    Posts
    146
    Rep Power
    12
    this is what I think you are looking for:

    Code:
    <html>
     <head>
      <script>
       function createInput(){
        var inputRadio = "<input name='rad' type='radio'>one<br>"
        inputRadio += "<input name='rad' type='radio'>two<br>"
        inputRadio += "<input name='rad' type='radio'>three<br>"
        document.getElementById("mainDiv").innerHTML=inputRadio 
       }
      </script>
     </head>
    <body>
     <input type="button" value="click me" onclick="createInput()">
     <p>
     <div id="mainDiv">
     </div>
    </html>
    You however were using the opener command, are you controlling another window??????
    Lewis Matthews

    http://www.madlou.com

IMN logo majestic logo threadwatch logo seochat tools logo