/    Sign up×
Community /Pin to ProfileBookmark

Javascript onClick

Hi Guys,

Im new to JS and was wondering if you could help me break the following HTML drop down box to work with images instead?

[code]
<form action=”/store/store.asp” method=”post” name=”currencyform” id=”currencyform”>
<table width=”100&#37;” cellspacing=”0″ cellpadding=”0″ border=”0″ id=”panel-currency”>
<tbody><tr><td><img height=”1″ width=”100%” border=”0″ src=”/store/images/spacer.gif” alt=””></td></tr>
<tr>
<td align=”left” class=”boxText”><p>Currency:<select onchange=”document.currencyform.submit()” id=”elecurrency” name=”newcurrency” class=”select”><option value=”1″>UK Pound</option><option selected=”selected” value=”2″>US Dollar</option><option value=”3″>Euro</option></select></p></td>
</tr>
<tr><td><img height=”1″ width=”100%” border=”0″ alt=”” src=”/store/images/spacer.gif”></td></tr>
</tbody></table>
<input type=”hidden” value=”set_currency” name=”doaction”>
<input type=”hidden” value=”do” name=”action”>
</form>
[/code]

What i want is just 3 images (representing the currency flag) I have tried just simply using the onclick=”” but im guessing i will need to create a JS function?

Any help would be appreciated guys!

Rory

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@FangApr 12.2010 — You can't have images in a dropdown.

http://www.cssplay.co.uk/menus/image_dropdown.html
Copy linkTweet thisAlerts:
@rstandleyauthorApr 12.2010 — Yes, i know this, i want to get rid of the drop down all together and just have 3 images.
Copy linkTweet thisAlerts:
@FangApr 12.2010 — Wrap the images in an anchor or give each image an onclick handler.
Copy linkTweet thisAlerts:
@rstandleyauthorApr 12.2010 — Yeah i was thinking it would be onclick, but do i not have to asign a value to each image?
Copy linkTweet thisAlerts:
@FangApr 12.2010 — What do you want to do exactly?
Copy linkTweet thisAlerts:
@rstandleyauthorApr 12.2010 — I want to be able to have 3 images, these images will be the UK flag the USA flag and the EU flag, when you click on them each one changes the currency of the webstie, currently we have the drop down box which i have posted in my first post.
Copy linkTweet thisAlerts:
@FangApr 12.2010 — and the currency value has to be used in a result, posted to the server, or ...
Copy linkTweet thisAlerts:
@rstandleyauthorApr 12.2010 — yeah, looking at the drop down menu, each textual name has been asigned a value of 1,2 or 3 each one corresponding with the right currency, but i dont know how to asign these to an image.
Copy linkTweet thisAlerts:
@FangApr 13.2010 — &lt;label&gt;&lt;img alt="flagUK" src="flagUK.gif"&gt;&lt;input type="radio" name="newcurrency" value="1"&gt;&lt;/label&gt;
&lt;label&gt;&lt;img alt="flagUS" src="flagUS.gif"&gt;&lt;input type="radio" name="newcurrency" value="2"&gt;&lt;/label&gt;
&lt;label&gt;&lt;img alt="flagEURO" src="flagEURO.gif"&gt;&lt;input type="radio" name="newcurrency" value="3"&gt;&lt;/label&gt;
×

Success!

Help @rstandley spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...