Ask a Question related to Dreamweaver AppDev, Design and Development.
-
kconnerty #1
Interactive Combo Box(es)
Hello:
I've been trying to get a text field to react to the changes in a combo box
selection with JavaScript, with no luck. I'm wondering if it is possible to do
this with some built in behaviours in Dreamweaver?
Basically, if you select the size of something "5 X 7" in the "Size" list box,
I would like the Price to reflect that the customer has chosen a photograph and
display the price amount ($8). I've tried putting in numerous 'if' statement
to a function and then calling the function on the OnClick command, but it
isn't updating the Price textfield at all in this way. I've added the onClick
behaviour to the list box by attaching the javascript and this doesn't do
anything, either. All combos are in the same form, although on different
fieldsets (would this make a difference in the document.orderForm... statement?)
Thanks, in advance for any help.
Kim Connerty
kconnerty Guest
-
Help Please! Interactive map
I have to create an interactive map, which shows the campus layout of a university. I want the user to be able to rollover, or click on any... -
Interactive Map
Hi!What I'd like to do is this I have an animation size ca. 500x400 dpi. In this animation I have a map of one part of a city that is cut into... -
interactive tv
Does anyone know where i can find some information on how to develope an interactive tv enviroment (preferably a tutorial). the specific type of... -
Interactive pdf?
Using an Excel spreadsheet, a program has been created to determine the high and low cost of an item. Is there a way to turn this spreadsheet into a... -
interactive map?
Please help, I'm trying to build an interactive map where a series of buttons to the side of the map add elements (roads, attractions, etc') onto... -
Manuel Socarras #2
Re: Interactive Combo Box(es)
use the onChange handler in the list box SELECT tag :
<HEAD>
<SCRIPT>
pricesArray = (8.00, 5.50, ...);
function changePrice(id) {
document.orderForm.Price.value = pricesArray(id);
}
</SCRIPT>
</HEAD>
<BODY>
....
<SELECT name="Size" ... onChange="changePrice(this.selectedIndex)">
....
<INPUT type"text" name="Price">
....
the pricesArray can be static (declare in the HTML page) or created
dinamically at server-side retrieving data from a DB
HTH,
manuel
kconnerty wrote:
> Hello:
>
> I've been trying to get a text field to react to the changes in a combo box
> selection with JavaScript, with no luck. I'm wondering if it is possible to do
> this with some built in behaviours in Dreamweaver?
>
> Basically, if you select the size of something "5 X 7" in the "Size" list box,
> I would like the Price to reflect that the customer has chosen a photograph and
> display the price amount ($8). I've tried putting in numerous 'if' statement
> to a function and then calling the function on the OnClick command, but it
> isn't updating the Price textfield at all in this way. I've added the onClick
> behaviour to the list box by attaching the javascript and this doesn't do
> anything, either. All combos are in the same form, although on different
> fieldsets (would this make a difference in the document.orderForm... statement?)
>
> Thanks, in advance for any help.
>
> Kim Connerty
>Manuel Socarras Guest
-
kconnerty #3
Re: Interactive Combo Box(es)
Thank you, Manuel. Appreciate the help.
I've put the code in and I understand how it's supposed to work - much better
than the "if" statements I was using. However, I continually get an error at
the browser: Error: function expected, when I select something from the
photoSize listbox.
The only change I made from what you posted was to replace 'price' with
'photoPrice', which is the name of the textfield. Here's the code snippet:
<!--
pricesArray = (6, 8, 12, 24, 36);
function changePrice(id) {
document.orderForm.photoPrice.value=pricesArray(id );
}
-->
The onChange calls the function for photoSize. I'm not totally versed in js
(as you can probably tell). Any additional help you propose will be greatly
appreciated.
Thanks,
Kim
kconnerty Guest
-
Manuel Socarras #4
Re: Interactive Combo Box(es)
sorry, was my fault; too much VBScript lately! change the parentheses
for brackets when referring to the array:
document.orderForm.photoPrice.value=pricesArray[id];
manuel
kconnerty wrote:> Thank you, Manuel. Appreciate the help.
>
> I've put the code in and I understand how it's supposed to work - much better
> than the "if" statements I was using. However, I continually get an error at
> the browser: Error: function expected, when I select something from the
> photoSize listbox.
>
> The only change I made from what you posted was to replace 'price' with
> 'photoPrice', which is the name of the textfield. Here's the code snippet:
>
> <!--
> pricesArray = (6, 8, 12, 24, 36);
>
> function changePrice(id) {
> document.orderForm.photoPrice.value=pricesArray(id );
> }
> -->
>
> The onChange calls the function for photoSize. I'm not totally versed in js
> (as you can probably tell). Any additional help you propose will be greatly
> appreciated.
>
> Thanks,
>
> Kim
>Manuel Socarras Guest
-
CMBergin #5
Re: Interactive Combo Box(es)
JavaScript is case sensitive. Make sure your lowercase and capital letters
match for everything - form name, field name, function name, etc.
"kconnerty" <webforumsuser@macromedia.com> wrote in message
news:cv2hum$h8o$1@forums.macromedia.com...better> Thank you, Manuel. Appreciate the help.
>
> I've put the code in and I understand how it's supposed to work - muchat> than the "if" statements I was using. However, I continually get an errorsnippet:> the browser: Error: function expected, when I select something from the
> photoSize listbox.
>
> The only change I made from what you posted was to replace 'price' with
> 'photoPrice', which is the name of the textfield. Here's the codejs>
> <!--
> pricesArray = (6, 8, 12, 24, 36);
>
> function changePrice(id) {
> document.orderForm.photoPrice.value=pricesArray(id );
> }
> -->
>
> The onChange calls the function for photoSize. I'm not totally versed ingreatly> (as you can probably tell). Any additional help you propose will be> appreciated.
>
> Thanks,
>
> Kim
>
CMBergin Guest



Reply With Quote

