Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
help with some simple javascript on select code
Old 02-07-2008, 11:50 PM help with some simple javascript on select code
Novice Talker

Posts: 10
Name: Cooper.
Location: Waterloo, Ontario. Canada.
Trades: 0
So ive got a drop down select menu with options 1 - 10. (i.e. "1" "2" "3" etc..)

When the user selects 3 from the select box, i need to do a math equation of 3 x 10 and put the result of 30 into a text field.

Anyone got a function that might help?
housefire is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-08-2008, 06:05 PM Re: help with some simple javascript on select code
Extreme Talker

Posts: 238
Location: United States
Trades: 0
Something like this would work:
Code:
function selectMultiply(){
  var objSelect = document.getElementById('id_of_select_element');
  var objText   = document.getElementById('id_of_text_input_element');

  objText.value = objSelect.value * 30;
}
On your select element, add the attribute onchange="selectMultiply()".

w3schools has a fairly decent reference to the HTML DOM for future reference.
frost is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to help with some simple javascript on select code
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20278 seconds with 12 queries