You are here: irt.org | FAQ | DHTML | Q457 [ previous next ]
Only in Netscape Navigator 4 and/or Internet Explorer 4 by the clever use of DHTML.
<SCRIPT LANGUAGE="JavaScript"><!-- var hidden = false; var mytext = '<FORM><SELECT><OPTION>This is option 1<OPTION>This is option 2<OPTION>This is option 3<OPTION>This is option 4<\/SELECT><\/FORM>'; function changeit() { if (hidden) { if (document.layers) { document.layers['GenericID'].document.open(); document.layers['GenericID'].document.writeln(mytext); document.layers['GenericID'].document.close(); } else if (document.all) document.all("GenericID").innerHTML= mytext; } else { if (document.layers) { document.layers['GenericID'].document.open(); document.layers['GenericID'].document.writeln(''); document.layers['GenericID'].document.close(); } else if (document.all) document.all("GenericID").innerHTML= ''; } hidden = !hidden; } //--></SCRIPT> <DIV ID="GenericID" STYLE="position: absolute"> <SCRIPT LANGUAGE="JavaScript"><!-- document.write(mytext); //--></SCRIPT> </DIV> <BR><BR><FORM><INPUT TYPE="BUTTON" VALUE="Click Me" onClick="changeit()"></FORM>