Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Mar 2003
    Location
    Detroit, Michigan, USA
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IE6 Controls on forms

    I'm trying to replicate certain functionality that I developed on Word but this time as part of an IE6 environment. I just can't figure out what the code would be to add a control on a form on the fly. Although I can access controls through the elements collection..I just can't find the way to create a button and upon clicking the button to add say a text box. Any ideas?
    Thanks in advance

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: IE6 Controls on forms

    Just to clarify, you want to add a textbox to a web page after clicking a button? I frankly don't know how well it would work to add a completely new control; I guess the collections of the document object model are dynamic, but I haven't really tried it out. I generally have used a button and a bit of script to hide or unhide a control or a section of a page.

    Here's a sample from the page; there's a "Search Again" button that, when clicked, disappears and is replaced by a small form:
    <UL>[img]images/srchagain.png[/img]

    <DIV ID="divCliSrchFrm" STYLE="display: none">
    <form METHOD="POST" ACTION="cltnames.asp" onsubmit="return TwoCharMinimum(this)"
    NAME="ClientSearchForm1" language="JavaScript">
    Form controls omitted for clarity
    </form>
    </DIV>[/list]This is the simple script invoked by the button:
    <UL>function openDivHideBtn(strDivID, strImgID)
    {
    var myDiv = document.getElementById(strDivID);
    myDiv.style.display = "block";
    var myImg = document.getElementById(strImgID);
    myImg.style.display = "none";
    }[/list]Hope this helps.

Posting Permissions

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