Results 1 to 2 of 2
Thread: IE6 Controls on forms
2003-11-08, 15:58 #1
- Join Date
- Mar 2003
- Detroit, Michigan, USA
- 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
2003-11-08, 21:05 #2
- Join Date
- Feb 2001
- Silicon Valley, USA
- Thanked 94 Times in 90 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:
<DIV ID="divCliSrchFrm" STYLE="display: none">
<form METHOD="POST" ACTION="cltnames.asp" onsubmit="return TwoCharMinimum(this)"
Form controls omitted for clarity
</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.