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
Old 07-14-2006, 05:06 AM Select Problem
dahak's Avatar
Skilled Talker

Posts: 60
Location: Romania
Trades: 0
I know this is simple but i can't get it to work.
I have a select that has two or three options,each time i click on an option it is removed from the select.
For example if i have two options and click on each the select will be empty.
I want to do a javascript that will verify if the select is empty will show an alert.

The select is in a form so each time i try to do that verification an alert should pop-up and not go to the action page.
This is what i tryied :
HTML Code:
var myindex = document.addtostageform.addressbook_id.selectedIndex;
            if (myindex == ) 
                {
                    alert("\nYou must make a selection from the drop-down menu.");
                    document.addtostageform.addressbook_id.focus();
                }
Thank you.
dahak is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-14-2006, 12:16 PM Re: Select Problem
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
if (myindex == ) is incomplete - it needs some thing to compare to. It should be:

if (myindex == "")
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Reply     « Reply to Select Problem
 

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.09681 seconds with 12 queries