Re: [OT] JS snippet needed

This WebDNA talk-list message is from

2006


It keeps the original formatting.
numero = 66916
interpreted = N
texte = Donovan, I'm a bit confused about what exactly you're trying to do? Do you have a working example I could look at? I'd be happy to assist, but I'm having a hard time figuring out what the end result should be? Do you want multiple select lists, with a depenency relationship? Are the colors and sizes stored in a database or are you going to hard code them? Maybe something like AJAX or Matt Kruse's DynamicOptionList.js is what you're looking for? http://www.clearnova.com/ajax/ http://www.javascripttoolbox.com/lib/dynamicoptionlist/ Marc Donovan Brooke wrote: > Donovan Brooke wrote: > >> Marc Thompson wrote: >> >>> OK, I couldn't stand it. The code I wrote quickly didn't work so I >>> went ahead fixed. Look here: >>> http://www.utah.edu/wc/choose.html >>> >>> Marc > > > > Hey Marc, > I'm finally getting around to working on this issue again. Thanks for the > code. This is a good start. However, I need to figure out some way > of identifying the right image name based off the color select value. > So, starting from your code below: > > > > -- the function: > > -- > > -- the Call: > > -- > > > > Can this be changed to an array that prepopulates both color and the > image name? > > For example, > Here is some code that populates data to another form select: > -- START CODE: > [!] ** Sample Array > arrayData[0] = 'RED|X Large|' > arrayData[1] = 'Blue|Small|' > arrayData[2] = 'Blue|Large|' > arrayData[3] = 'Blue|XX Large|' > ** [/!] > > function populateData( __COLOR ) { > select = window.document.size_color.__SIZE; > string = ""; > // 0 - will display the new options only > // 1 - will display the first existing option plus the new options > count = 0; > // Clear the old list (above element 0) > select.options.length = count; > // Place all matching categories into Options. > for( i = 0; i < arrayData.length; i++ ) { > string = arrayData[i].split( "|" ); > if( string[0] == __COLOR ) { > select.options[count++] = new Option( string[1] ); > } > } > // Set which option from subcategory is to be selected > // select.options.selectedIndex = 2; > // Give subcategory focus and select it > // select.focus(); > } > -- END CODE > > > > > Notice the pipe delimiter. The code above first matches the color, > then the pulls the value to populate into the other select menu. > I would like to convert this so that I can match the color and pull the > adjacent image name to change the image. I can create the array easy > enough but my javascript is pretty lacking. I'll be working on it > but if anyone can easily tackle it, I'd appreciate it. > > Donovan > > > -- ------------------------------------------- Marc Thompson Software Engineer Office of Information Technology University of Utah 801.585.9264 marc.thompson@utah.edu ------------------------------------------- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  2. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  3. Re: [OT] JS snippet needed ( devaulw@onebox.com 2006)
  4. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  5. Re: [OT] JS snippet needed ( Marc Thompson 2006)
  6. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  7. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  8. Re: [OT] JS snippet needed ( "Bess Ho" 2006)
  9. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  10. Re: [OT] JS snippet needed ( Marc Thompson 2006)
  11. Re: [OT] JS snippet needed ( Marc Thompson 2006)
  12. Re: [OT] JS snippet needed ( "Dan Strong" 2006)
  13. [OT] JS snippet needed ( Donovan Brooke 2006)
Donovan, I'm a bit confused about what exactly you're trying to do? Do you have a working example I could look at? I'd be happy to assist, but I'm having a hard time figuring out what the end result should be? Do you want multiple select lists, with a depenency relationship? Are the colors and sizes stored in a database or are you going to hard code them? Maybe something like AJAX or Matt Kruse's DynamicOptionList.js is what you're looking for? http://www.clearnova.com/ajax/ http://www.javascripttoolbox.com/lib/dynamicoptionlist/ Marc Donovan Brooke wrote: > Donovan Brooke wrote: > >> Marc Thompson wrote: >> >>> OK, I couldn't stand it. The code I wrote quickly didn't work so I >>> went ahead fixed. Look here: >>> http://www.utah.edu/wc/choose.html >>> >>> Marc > > > > Hey Marc, > I'm finally getting around to working on this issue again. Thanks for the > code. This is a good start. However, I need to figure out some way > of identifying the right image name based off the color select value. > So, starting from your code below: > > > > -- the function: > > -- > > -- the Call: > > -- > > > > Can this be changed to an array that prepopulates both color and the > image name? > > For example, > Here is some code that populates data to another form select: > -- START CODE: > [!] ** Sample Array > arrayData[0] = 'RED|X Large|' > arrayData[1] = 'Blue|Small|' > arrayData[2] = 'Blue|Large|' > arrayData[3] = 'Blue|XX Large|' > ** [/!] > > function populateData( __COLOR ) { > select = window.document.size_color.__SIZE; > string = ""; > // 0 - will display the new options only > // 1 - will display the first existing option plus the new options > count = 0; > // Clear the old list (above element 0) > select.options.length = count; > // Place all matching categories into Options. > for( i = 0; i < arrayData.length; i++ ) { > string = arrayData[i].split( "|" ); > if( string[0] == __COLOR ) { > select.options[count++] = new Option( string[1] ); > } > } > // Set which option from subcategory is to be selected > // select.options.selectedIndex = 2; > // Give subcategory focus and select it > // select.focus(); > } > -- END CODE > > > > > Notice the pipe delimiter. The code above first matches the color, > then the pulls the value to populate into the other select menu. > I would like to convert this so that I can match the color and pull the > adjacent image name to change the image. I can create the array easy > enough but my javascript is pretty lacking. I'll be working on it > but if anyone can easily tackle it, I'd appreciate it. > > Donovan > > > -- ------------------------------------------- Marc Thompson Software Engineer Office of Information Technology University of Utah 801.585.9264 marc.thompson@utah.edu ------------------------------------------- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Marc Thompson

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

RE: [WebDNA] Windoes Server2008 users? (2011) international time (1997) Multiply prices (1997) Extended [ConvertChars] (1997) Search Engines (2002) email program problem (1998) Migrating to NT -Reply (1997) XML Syntax, Cookies and Variables.... (2004) Interfacing WebMerchant to www.fedex.com (1997) Am on the list? (1997) Open Market's Transact & Macintosh (1998) [WriteFile] problems (1997) [WebDNA] .debug file (2009) Nested tags count question (1997) problem with applets embedded in tpl files (1997) WebDNA for business intelligence? (2002) Credit card processing - UK (1997) restart needed???? (1997) WebCat2 beta 11 - new prefs ... (1997) taxTotal, grandTotal (1997)