need help dynamically creating forms with DOM

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NewmanBT

    need help dynamically creating forms with DOM

    I'm trying to create a fairly simple form which contains a label, a
    button, and a textbox.
    I've done quite a bit of reading and, from what I can figure, the
    following should work, but isn't.

    var rowCommentBox = document.create Element("TR");
    var cellCommentBox = document.create Element("TD");
    var frmCommentBox = document.create Element("FORM") ;
    frmCommentBox.s etAttribute("ME THOD", "POST");
    var strAction = "\"submitCommen ts.asp?Org=\"+s trOrg+\"&date=\ "+activeWeekBeg ins\""
    frmCommentBox.s etAttribute("AC TION", strAction);
    var rowFrmCommentBo x = document.create Element("TR");
    var cellFrmCommentB oxLabel = document.create Element("TD");
    var strFrmCommentLa bel = document.create TextNode("comme nt:");
    var cellFrmCommentB oxButton = document.create Element("TD");
    var btnFrmCommentBo xButton = document.create Element("INPUT" );
    btnFrmCommentBo xButton.setAttr ibute("TYPE", "SUBMIT");
    btnFrmCommentBo xButton.setAttr ibute("VALUE", "UPDATE");
    var cellFrmCommentB oxTxtbx = document.create Element("TD");
    var txtbxFrmComment BoxTxtbx = document.create Element("INPUT" );
    txtbxFrmComment BoxTxtbx.setAtt ribute("TYPE", "TEXT");
    txtbxFrmComment BoxTxtbx.setAtt ribute("cols", "50");
    txtbxFrmComment BoxTxtbx.setAtt ribute("VALUE", strComments);

    cellFrmCommentB oxLabel.appendC hild(strFrmComm entLabel);
    rowFrmCommentBo x.appendChild(c ellFrmCommentBo xLabel);
    cellFrmCommentB oxButton.append Child(btnFrmCom mentBoxButton);
    rowFrmCommentBo x.appendChild(c ellFrmCommentBo xButton);
    cellFrmCommentB oxTxtbx.appendC hild(txtbxFrmCo mmentBoxTxtbx);
    rowFrmCommentBo x.appendChild(c ellFrmCommentBo xTxtbx);
    frmCommentBox.a ppendChild(rowF rmCommentBox);
    rowCommentBox.a ppendChild(frmC ommentBox);
    tbodyOrgToAdd.a ppendChild(rowC ommentBox);

    help would be greatly appreciated.
  • kaeli

    #2
    Re: need help dynamically creating forms with DOM

    In article <bf8e13af.04051 30513.36b8da14@ posting.google. com>,
    brian.newman@wp afb.af.mil enlightened us with...[color=blue]
    > I'm trying to create a fairly simple form which contains a label, a
    > button, and a textbox.
    > I've done quite a bit of reading and, from what I can figure, the
    > following should work, but isn't.
    >[/color]
    What happens? Do you get an error? What browser?
    [color=blue]
    > help would be greatly appreciated.[/color]

    Full working (or not, as the case may be *LOL*) example would be
    appreciated if you want debugging help. ;)



    --
    --
    ~kaeli~
    Shotgun wedding: A case of wife or death.



    Comment

    Working...