JavaScript error - any clues

Results 1 to 4 of 4

Thread: JavaScript error - any clues

  1. #1
    Jennifer Rose Guest

    Default JavaScript error - any clues

    I&#039m calling this function on the onchange event on my select and getting a runtime error that document.myform.lstcmp.value is not an object. Clues????<BR> &#060;SCRIPT LANGUAGE="JavaScript"&#062;<BR> &#060;!--<BR> <BR> function checkit() {<BR> var cmp2 = document.myform.lstcmp.value;<BR> var intcmp2 = parseInt(cmp2);<BR> alert("Checkit say cmp2 is " + cmp2);<BR> if ( intcmp2 &#062; 0 ) {<BR> return( true );<BR> } else {<BR> alert("No Company is selected");<BR> return( false );<BR> }<BR> }<BR> &#060;!-- end script --&#062;<BR> &#060;/SCRIPT&#062;

  2. #2
    Tristan Guest

    Default RE: JavaScript error - any clues

    Make sure that your form is named "myform" and that the object you want to reference is named "lstcmp". Remember that Javascript is case sensitive. That&#039s all that I can think of.

  3. #3
    Join Date
    Dec 1969

    Default RE: JavaScript error - any clues

    If lstcmp is the name of a select box, then you need something like:<BR><BR>var cmp2 = document.myform.lstcmp[document.myform.lstcmp.SelectedIndex].value<BR><BR>where the SelectedIndex property of the select box returns the index that is currently selected.

  4. #4
    Join Date
    Dec 1969

    Default RE: JavaScript error - any clues

    Make sure that you exactly match the syntax used in the form.

Posting Permissions

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