Re: Javascript and Search Results

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 17432
interpreted = N
texte = On 4/30/1998 2:03 PM, jimmy so noted...>I have been working on a results page that has javascripted buttons which >add items to a cart. >Now, when I get my search results only the last button of the search >returns 'true' visually. >All the buttons before the last button cause the last button to return >'true, yet the prior buttons don't return true. >And still all the buttons return the localize text(in the javascript).In scanning the code, it looks like the problem stems from all images having the same name (cart), so the reference to the .src property only trips the last one drawn on the page. Since you're already in a [founditems] context, you can create a unique ID for each image with the [index] tag: Unfortunately, it looks like this will break your setimg() and helptxt() functions. It looks like they were designed to handle a variable-length array of images and help text messages per page. Since you're only toggling between the two images and a single phrase, the following tightening-up revisions should work: function helptxt ( ) { self.status = cart_txt; return true; } function setimg ( name, activate ) { if (versionOK) { if (activate) document.images[name].src=cart_active.src;} else document.images[name].src=cart.src;} } return helptxt ( ); }I haven't tested this out, but it looks good on paper! Hope it's of some help : )Rob Marquardt Designer/Resident Wirehead Toast Design300 First Avenue North, Suite 150 Minneapolis MN 55401 612.330.9863 v 612.321.9424 f www.toastdesign.com Associated Messages, from the most recent to the oldest:

    
  1. Re: Javascript and Search Results (Rob Marquardt 1998)
  2. Javascript and Search Results (jimmy 1998)
On 4/30/1998 2:03 PM, jimmy so noted...>I have been working on a results page that has javascripted buttons which >add items to a cart. >Now, when I get my search results only the last button of the search >returns 'true' visually. >All the buttons before the last button cause the last button to return >'true, yet the prior buttons don't return true. >And still all the buttons return the localize text(in the javascript).In scanning the code, it looks like the problem stems from all images having the same name (cart), so the reference to the .src property only trips the last one drawn on the page. Since you're already in a [founditems] context, you can create a unique ID for each image with the [index] tag:[url][SKU][/url]&cart=[cart]&db=petma ll.db onMouseOver=return setimg('cart[index]',true) onMouseOut=return setimg('cart[index]',false)> Unfortunately, it looks like this will break your setimg() and helptxt() functions. It looks like they were designed to handle a variable-length array of images and help text messages per page. Since you're only toggling between the two images and a single phrase, the following tightening-up revisions should work: function helptxt ( ) { self.status = cart_txt; return true; } function setimg ( name, activate ) { if (versionOK) { if (activate) document.images[name].src=cart_active.src;} else document.images[name].src=cart.src;} } return helptxt ( ); }I haven't tested this out, but it looks good on paper! Hope it's of some help : )Rob Marquardt Designer/Resident Wirehead Toast Design300 First Avenue North, Suite 150 Minneapolis MN 55401 612.330.9863 v 612.321.9424 f www.toastdesign.com Rob Marquardt

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:

Nesting FoundItem Context (1997) Multiple cart additions (1997) Initiating NewCart (1997) File Security (1999) MacAuthorize order data fields WAS:How To question... (1997) WebMerchant 1.6 and SHTML (1997) RE: Ongoing group search problems ... (1997) Ok here is a question? (1997) Search results templates (1996) [LOOKUP] (1997) tmpl Vs DB (1999) How many lookups does it take ... (2003) Incorrect Value Display (2000) [OT]Applescript/.db (was:FTP to WebStar) (2001) Re:Emailer and encryption (1997) SSL and reg web*L and reg web* (1997) Emailer setup (1997) HELP - NONE STOP DIGESTS. Digest for 4/24/97) (1997) MacWEEK article help needed (1996) Database Security (1998)