JavaScript Question

Results 1 to 2 of 2

Thread: JavaScript Question

  1. #1
    Jon Guest

    Default JavaScript Question

    I have a form where the user will enter two times. After these times are entered I want a dropdown option to be populated with two different values:<BR>1. the difference between the two times.<BR>2. the difference between the two times + 30 minutes.<BR>I have written a function that gets the values for 1 and 2 but how do I write these values into the dropdown box after an event on one of the objects on the form.<BR>Thank You. <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: JavaScript Question

    ...<BR>function test(){<BR>// This changes a value and text shown in a list box<BR>document.MyForm.MyListBox.options[1].value="test";<BR>document.MyForm.MyListBox.option s[1].text="test";<BR><BR>// OR This adds a new value<BR>var L = document.MyForm.MyListBox.options.length<BR>docume nt.MyForm.MyListBox.options[L] = new Option("test");<BR>document.MyForm.MyListBox.optio ns[L-1].value = "test"<BR>}<BR>...<BR><BR>On your form element add the event bit:<BR> onClick="test(); return false;" <BR>

Posting Permissions

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