Click to See Complete Forum and Search --> : Easy for some


someweirdo
12-08-2002, 04:31 AM
Ok this is prolly easy for someone out there so i'm crossing my fingers that someone will help me. I'm looking for a javascript that does the following:

when one clicks on a specified link a text box with a "submit" button will just simply "appear" on the page, otherwise it is hidden.

Rick Bull
12-08-2002, 06:29 AM
You could try something like this, which will work for people without JavaScript as well:


<form id="hidden_form"><p>
<input type="text" />
<input type="submit" />
</p></form>
<script type="text/javascript"><!--
function changeDisplay(elementId) {
if (document.getElementById) {
var element = document.getElementById(elementId);
element.style.display = (element.style.display == 'none') ? 'block' : 'none';
}
return false;
}
changeDisplay('hidden_form');
//Write the link
document.open();
document.write('<a href="#" onclick="return changeDisplay(\'hidden_form\');">Show form<\/a>');
document.close();
//--></script>