It works for me.  But you must actually select a different option or the onChange event will not fire.  So if "For Sale" is selected and you pull down the list and select "For Sale" again, nothing will happen because nothing changed...


Chris

-----Original Message-----
From: Stuart Kidd [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 11:35 AM
To: CF-Talk
Subject: RE: select boxes and _javascript_

Thanks for that Chris and Tom,

I think i went over my head as i found this script at http://developer.apple.com/internet/webcontent/examples/choose_form_source.html which seemed to work pretty cool. (Example of it working is at http://developer.apple.com/internet/webcontent/examples/choose_form.html).

I thought i'd try and change the script so instead of using radio buttons it would use a dropdown box... that's where all my troubles started! :)

I tried your code Chris but nothing happened, no errors either.

Am I missing something (apart from _javascript_ knowledge!).

Stuart

---------- Original Message ----------------------------------
From: "Lofback, Chris" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date:  Tue, 2 Mar 2004 11:21:03 -0500

>You probably want to use the onChange event for the select list itself, something like this (untested code) :
>
><SCRIPT LANGUAGE="_javascript_">
> function doSwitchDIV(oSelList) {
>  var val = oSelList.options[oSelList.selectedIndex].value;
>  if (val == 'forsale') switchDiv('ez');
>  if (val == 'forrent') switchDiv('full');
>  if (val == 'forlease') switchDiv('superduper');
> }
></SCRIPT>
>
><cfform name="the_form">
><tr height="12" valign="top">
><td align="left"><cfselect name="PropertyDataHouseType" class="#SMSformStyle1#">
><option value="forsale">For Sale</option>
><option value="forrent">For Rent</option>
><option value="forlease">For Lease</option>   
></cfselect></td>
><td align="left"> </td>
><td align="left"> </td>
></tr>
></cfform>
>
>
>Chris
>
>-----Original Message-----
>From: Stuart Kidd [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, March 02, 2004 11:10 AM
>To: CF-Talk
>Subject: select boxes and _javascript_
>
>
>Hi guys,
>
>I'm trying to work out how to trigger my _javascript_ within a select box:
>
><cfform name="the_form">
><tr height="12" valign="top">
><td align="left"><cfselect name="PropertyDataHouseType" class="#SMSformStyle1#">
><option value="forsale" Sale</option>
><option value="forrent" Rent</option>
><option value="forlease" Lease</option>   
></cfselect></td>
><td align="left"> </td>
><td align="left"> </td>
></tr>
></cfform>
>
>I've tried all types like onMouseOut, OnChange, onClick, does anyone know what i should be using?  It's setting off a script to show the appropriate DIV.
>
>Thanks,
>
>Stuart
>
>
>
>
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to