Reference element ID as opposed to name

Discussion in 'JavaScript' started by wilson1000, Jul 26, 2007.

  1. #1
    Hello,

    Would someone kindly tell me how I can activate the setForm() function on a form by using the form tag "ID" instead of "name"?

    I am trying to get the page to validate as strict XHTML.

    Heres the javascript code:

    function setForms() {
    if (document.loginForm){
    document.loginForm.loginUser.value = 'Enter Username';
    document.loginForm.loginUser.className='blurText';
    }
    if (document.loginForm){
    document.loginForm.loginPword.value = 'EnterPass';
    document.loginForm.loginPword.className='blurText';
    }

    }

    Many thanks
     
    wilson1000, Jul 26, 2007 IP