Results 1 to 2 of 2

Thread: E-mail form Activation and deactivation

  1. #1
    Join Date
    Nov 2011
    Location
    NJ
    Posts
    10
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default E-mail form Activation and deactivation

    '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;
    }
    Last edited by dz.slick; 11-21-2011 at 03:53 PM.

  2. #2
    Join Date
    Jul 2008
    Posts
    128
    Thanks
    0
    Thanked 17 Times in 16 Posts

    Default

    Code:
    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.

    Code:
    (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 );
    Last edited by clueful; 11-21-2011 at 11:41 PM.

Bookmarks

Posting Permissions

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