/    Sign up×
Community /Pin to ProfileBookmark

Javascript Drop Down Menu to Change Hidden Text

I own my own website that sells costumes and I am looking for some javascript code that will change my item numbers when someone selects a different size from the drop down list.

Heres an example

I have some hidden code for my attributes

<input type= “hidden” name=”item_number” value=”SW007″>

<select name=”sel1″>
<option value=”Size: Small”>Small</option>
<option value=”Size: Medium”>Medium</option>
<option value=”Size: Large”>Large</option>
</select>

So If someone chooses Small I would like the number to be “SW007”, but if they choose Medium I would like the item number to be “SW008”

Could someone please direct me on where I might find the information to do this?

Thank You

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@sridhar_423May 03.2006 — <script language=JavaScript>

ItemsArray = new Array();

ItemsArray["Size: Small"]="SW007";

ItemsArray["Size: Medium"]="SW008";

ItemsArray["Size: Large"]="SW009";

</Script>

<input type= "hidden" name="item_number" value="SW007">


<select name="sel1" onChange="item_number.value=ItemsArray[this.value]">

<option value="Size: Small">Small</option>

<option value="Size: Medium">Medium</option>

<option value="Size: Large">Large</option>

</select>
Copy linkTweet thisAlerts:
@tomfallensteinauthorMay 03.2006 — this doesnt seem to be working quite right. Is there something im doing wrong?

Here is my test page

http://www.flappercostumes.com/test.html
Copy linkTweet thisAlerts:
@tomfallensteinauthorMay 03.2006 — can anyone help me out with this?

Thank You
Copy linkTweet thisAlerts:
@sridhar_423May 05.2006 — edit the line "<input type= "hidden" name="item_number" value="SW007">" to "<input type= "text" name="item_number" value="SW007">" and check it out yourself.. its working fine..
×

Success!

Help @tomfallenstein 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...