bnelson.com Home Page



















Note: these are simply brain joggers for my own use. I keep forgetting the syntax on these darn things.

[ Checkbox Element | Radio Element | Dropdown Menu Value | Read Only Form Text ]

Checkbox Element


function setOptions()
{

   if ( (document.form1.checkbox1.checked) && ( (document.form1.checkbox2.checked) || (document.form1.checkbox3.checked) ) )
   {
        alert("If you select checkbox1, you cannot select either checkbox2 or checkbox3.");

        // force the other two checkboxes off
        document.form1.checkbox2.checked = 0;
        document.form1.checkbox3.checked = 0;    

   }
}

Another example that only works under Netscape

function setOptions()
{

   if ( (document.form1.checkbox1.checked) && ( (document.form1.checkbox2.checked) || (document.form1.checkbox3.checked) ) )
   {
        alert("If you select checkbox1, you cannot select either checkbox2 or checkbox3.");

        if (document.resign.resignFromClients.checked)
        {
            document.resign.resignFromClients.click();
        }

        if (document.resign.opxDisconnect.checked)
        {
            document.resign.opxDisconnect.click();
        }
    }

}

How you would access this subroutine from the form
<FORM NAME="form1">
<INPUT TYPE="checkbox" NAME="checkbox1" onClick='javascript:setOptions()'>checkbox1
<INPUT TYPE="checkbox" NAME="checkbox2" onClick='javascript:setOptions()'>checkbox2
<INPUT TYPE="checkbox" NAME="checkbox3" onClick='javascript:setOptions()'>checkbox3
</FORM">
      

Radio Element Value


function launchWindow(form)
{
    helpboxValue = getRadioButtonValue(form.helpbox)

    if (helpboxValue == "Yes")
    {
        top.newWin = window.open('newwindow/index.html','Instructions','width=575,height=400,scrollbars=yes,resizable=yes')
    }
}

// function to return the value associated with a radio button selection
function getRadioButtonValue (radio) {

    for (var i = 0; i < radio.length; i++)
    {
        if (radio[i].checked) { break }
    }
    return radio[i].value
}

      

Dropdown Menu Value

      
    if (document.form1.elementname[document.form1.elementname.selectedIndex].value == "")
    {
        alert("Please select an option from the dropdown menu (elementname).");
        return false;
    }

    How you would access this subroutine from the form
    <FORM NAME="form1">
    <SELECT NAME="elementname">
    <OPTION VALUE="">Please Select Reason
    <OPTION VALUE="Moving out of Network area">Moving out of Network area
    <OPTION VALUE="Moving and can not afford reconnection fees">Moving and can not afford reconnection fees
    <OPTION VALUE="Can not afford monthly fees">Can not afford monthly fees
    <OPTION VALUE="Can not get hours">Can not get hours
    <OPTION VALUE="Can not get additional clients">Can not get additional clients
    <OPTION VALUE="Conflict with full-time job">Conflict with full-time job
    <OPTION VALUE="Family/Medical problems">Family/Medical problems
    <OPTION VALUE="Did not like Customer Service work">Did not like Customer Service work
    <OPTION VALUE="Did not like Sales">Did not like Sales
    <OPTION VALUE="Call Volume">Call Volume
    <OPTION VALUE="Connectivity/technical problems">Connectivity/technical problems
    <OPTION VALUE="Not making enough money">Not making enough money
    <OPTION VALUE="Looking for other type of work">Looking for other type of work
    <OPTION VALUE="Dissatisfied with Willow concept">Dissatisfied with Willow concept
    <OPTION VALUE="Dissatisfied with Client(s) concept">Dissatisfied with Client(s) concept
    <OPTION VALUE="Other">Other
    </SELECT>
    </FORM>
    

Read Only Form Text

      
      <FORM>
      <INPUT TYPE="text" NAME="output" SIZE="30" onFocus="this.blur()">
      </FORM>
      

Other Links