Forum Moderators: open

Message Too Old, No Replies

Currency Image Change

         

drewolf

7:07 pm on Aug 9, 2010 (gmt 0)

10+ Year Member



Here's what the client wants to happen:

http://img227.imageshack.us/img227/3196/curre.jpg

There are three available currencies on his online shop; what he wants is when a user clicks on a particular currency, the icon retains the box highlight.

I've tried to use the changeimage() option, but what happens is, when you click the desired currency, the box highlight only shows up for a millisecond, then disappears.

I was just wondering if it IS possible, what the client wants to happen.

whoisgregg

9:29 pm on Aug 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, drewolf!

It's definitely possible. You'd have to look at the changeimage() function and see what it does.

Also, this would be a preference that would need to be retained as the user browses through the site so you'd need to store that preference in a cookie or session.

If you'd like to post a relevant code snippet, I'm sure we'd be able to help. :)

drewolf

9:36 pm on Aug 9, 2010 (gmt 0)

10+ Year Member



This is the current script that we have


function changeimage()
{
window.location = "/app/site/backend/setshoppercurrency.nl?selcurrency=1&c=1008669&sc.<%=getCurrentAttribute('siteCategory','internalID')%>&cc=1/.f"
document.getElementById('myimage').src="/site/curr/pound_on.png";
document.getElementById('myimage2').src="/site/curr/euro_off.png"
document.getElementById('myimage3').src="/site/curr/dollar_off.png"
}


It applies to this:


<a href="#" title="Pounds"> <img id="myimage" onClick="changeimage()" border="0" src="/site/curr/pound_off.png" width="12" height="12"/ alt="Pounds"> </a>

drewolf

9:38 pm on Aug 9, 2010 (gmt 0)

10+ Year Member



Oh, and when the link is clicked, the page reloads; and I think that is what causes the box highlight to go away.

whoisgregg

1:24 pm on Aug 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Since you're reloading the page anyhow, you don't really need javascript to change the icon.

In your server-side code (ASP?), just print the *_off.png or *_on.png based on the current stored currency setting.

drewolf

6:14 pm on Aug 10, 2010 (gmt 0)

10+ Year Member



we're actually using Netsuite for this website, if that helps.