Re: regex question - trying to find ".mp3" in a SELECT box
- From: Randy Webb <HikksNotAtHome@xxxxxxx>
- Date: Tue, 30 May 2006 17:59:06 -0400
Jake Barnes said the following on 5/30/2006 5:00 PM:
I've a form for creating podcast episodes. The user can pick an MP3
from a drop down box (an HTML select box). I'm trying to add some error
checking. In the code below, I try to get the value of the select box,
and then I try to see if it contains the string ".mp3". I'm getting the
alert message every time. Why is that?
var selectValue = document.forms['formID'].elements['selectName'.value;
if (selectValue.indexOf('.mp3') != -1){
alert('Your value has .mp3 in it')
}
else{
alert('Your value does not have .mp3 in it')
}
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
.
- References:
- regex question - trying to find ".mp3" in a SELECT box
- From: Jake Barnes
- regex question - trying to find ".mp3" in a SELECT box
- Prev by Date: Re: removing an HTML element
- Next by Date: Re: Automated Form submission
- Previous by thread: regex question - trying to find ".mp3" in a SELECT box
- Next by thread: Re: regex question - trying to find ".mp3" in a SELECT box
- Index(es):
Relevant Pages
|