PDA

View Full Version : E-mail form Activation and deactivation



dz.slick
11-21-2011, 08:38 AM
'm trying to get the code below to keep an E-mail form deactivated until 6 seconds after the page is fully loaded but it hasn't been working. Please help me.
var inActive = true;
function inActive() {
if (!inActive)
return true;

inActive = true;
document.getElementById("myForm").disabled = true;

setTimeout(function() {
inActive = true;
document.getElementById("myForm").disabled = false;
}, 1000);

return true;
}

clueful
11-21-2011, 11:32 PM
var inActive = true;
function inActive() {

You cannot have two objects in common scope with the same name.

Be advised that only IE supports form disabling.



(function( id, secs ) // Put me *below* the form
{
var theForm = document.getElementById( id );

function f( action )
{
var fe = theForm.elements;

for( var i = 0, elem; ( elem = fe[ i ] ); i++ )
elem.disabled = !action;
}

f( false );

setTimeout( function(){ f( true ); }, secs * 1000 );

})( "myForm", 6 );