Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Basic Javascript.

This is a discussion on Basic Javascript., within the Javascript section. This forum and the thread "Basic Javascript." are both part of the Programming Your Website category.

 
Reply to this topicStart new topic
> Basic Javascript.
Jason
post Apr 3 2008, 05:05 AM
Post #1


Master of the Universe
******

Group: Advisors
Posts: 1,157
Joined: 15-February 08
From: London, England
Member No.: 141



I know how to do switch statements and write to the document.

How do I gather the information from a drop box?

I want to print a number depending on what option is selected. I also plan to use this for some dynamic form helpers.

So..

How do I gather the option from a select box?
How do I tell if a user has selected an input box?
How do I tell if the user has filled in an input box?


--------------------
Go to the top of the page
 
+Quote Post
c010depunkk
post Apr 3 2008, 05:54 AM
Post #2


Rapid Squeezer
****

Group: Advisors
Posts: 178
Joined: 14-February 08
From: Willich, Germany
Member No.: 56



1: When you create the options for a select box you give each one a value:
CODE
<option value="1">one</option>

Then you can find out which option is selected like so:
CODE
var select_box_value=document.getElementById('select_box_id').value;


2: Well, not sure if this is the best solution, but you could set a global variable to "true" or "false" in the onblur() and onfocus() events of an input.

3:About the same as above, you can check the "value" property:
CODE
var input_value=document.getElementById('input_id').value;


--------------------
www.c010depunkk.com ~ the hangout of a web developer
Go to the top of the page
 
+Quote Post
Jason
post Apr 3 2008, 05:57 AM
Post #3


Master of the Universe
******

Group: Advisors
Posts: 1,157
Joined: 15-February 08
From: London, England
Member No.: 141



Thanks a lot, that should be enough to get me going.

I'll post back here if I get stuck.


--------------------
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   2 marSoul 245 23rd February 2008 - 10:52 AM
Last post by: marSoul
No new   25 Jasontor 658 19th March 2008 - 02:15 PM
Last post by: Jasontor
No New Posts   1 Itsumishi 122 28th March 2008 - 01:23 AM
Last post by: Vanessa
No New Posts   13 Jason 316 17th April 2008 - 12:55 AM
Last post by: Ryan
No New Posts   6 Jason 243 2nd June 2008 - 04:35 AM
Last post by: Monie