Results 1 to 2 of 2

Thread: Java script

  1. #1

    Thread Starter
    Hyperactive Member DaveR's Avatar
    Join Date
    Mar 2001
    Location
    Ireland
    Posts
    268

    Question Java script

    Hello, I am trying to write a small piece of javascript , and it aint going to plan.

    Its on an ASP page,
    <script language="JavaScript" type="text/javascript">

    var frmvalidator = new Validator("mainform");

    if (form1.select1 contains the letter X) then
    frmvalidator.addValidation("select1")

    </script>

    --where form1 is the form name and select1 is a menu/list box.
    I basically want to use the addValidation function only when a certain condition is met , that the menu/list box value selected contains an X.
    For anyone can understand what i'm trying to say , if you have a knowledge of javascript and an idea of how to solve this problem,
    please let me know,
    THanks
    DaveR

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You can get the value of the currently selected option with this line (sel is the select box):
    sel.options[sel.selectedIndex].value
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width