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:

ReturnRaw context (1997) Separate SSL Server (1997) Webmerchant/Cybercash (2000) Separate SSL Server (1997) date (1999) syntax question, not in online refernce (1997) ConverChars (1999) Bug or syntax error on my part? (1997) Erotic Sites (1997) URGENT! Locked DB's (2001) WC2b15 - [HTMLx]...[/HTMLx] problems SOLVED! (1997) Emailer again & again (1997) RE: E-mailer error codes (1997) Re:Can anyone help me with this shipping thing? (1998) HELP - NONE STOP DIGESTS. Digest for 4/24/97) (1997) my price won't move (1997) More Applescript (1997) All choices on IE different than Netscape (1997) [WebDNA] WebDNA as cgi app (was WebSite Examples) (2008) [WebDNA] FastCGI running more than one process! (2013)