[thelist] [javaScript] removing values from forms

Lee Kowalkowski lee.kowalkowski at googlemail.com
Wed Jul 8 08:43:41 CDT 2009


2009/7/8 Tris <beertastic at gmail.com>:
> I'm trying to clear an input box is the default value is not changed..
> Here's what I've got and can't figure why it's not working...?
> Thoughts...?
>
>  function clearBox(inputName, inputDisplay) {
>    if (document.addUser.inputName.value = inputDisplay) {
>      document.addUser.inputName.value = '';
>    }
>  }

I think it should be document.addUser[inputName].value - and the
condition should have == (potentially === to keep it strict, but
certainly not one = by itself).

-- 
Lee
www.webdeavour.co.uk



More information about the thelist mailing list