www.webdeveloper.com
Results 1 to 3 of 3

Thread: Help creating a function

  1. #1
    Join Date
    Mar 2010
    Posts
    2

    Help creating a function

    I'm trying to make a function that will enable any given form field. This is what I have, my form name is 'searchfields':
    Code:
    function EnableDisable(field)
    {
    	var loc = 'document.searchfields.'+field;
    	loc.disabled = false;
    }
    However, this is not working. Any suggestions?

  2. #2
    Join Date
    Feb 2010
    Location
    Amsterdam
    Posts
    174
    function EnableDisable(field)
    {
    var formname = 'searchfields';
    document[formname][field].disabled = false;
    }

  3. #3
    Join Date
    Mar 2010
    Posts
    2
    Thanks; now one more question. If I call a function onKeyPress or onKeyDown on a text field, then every time a key is pressed the function gets called. How can I make it so that the function is called only on the first key press? Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles