Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-03-2006, 04:39 PM   PM User | #1
hominid4
New to the CF scene

 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
hominid4 is an unknown quantity at this point
Pulldown Menu Choose MP3 Script

Hi, I'm just learning scripting and have no idea if I'm doing this correctly. I have a script where in a form I have a pulldown menu listing multiple MP3s, next to the pulldown is a "Play" button. When a MP3 is selected and Play is clicked it pops up a small window and plays the MP3. This works as I need it but the problem I'm having is if "None" is selected and "Play" is clicked I'm needing a small pop up saying "No sound selected.".

I thought it would be simple using a IF ELSE command but I can't get it to work. What I have in the head is:
Code:
function PlaySound(SongURL)

if (SongURL == "None")
   {
   alert("No sound selected.");
   }
else
   {
PopUp = window.open (SongURL, "width=200,height=30")
   }
and in the body form I have:
Code:
<select name="music" onchange="javascript:formHandler()">
<option selected value="None">None</option>
   <option value="01.mp3">01.mp3</option>
   <option value="02.mp3">02.mp3</option>
   <option value="03.mp3">03.mp3</option>
</select> <input onclick="PlaySound(music.options[music.selectedIndex].value)" type="button" value="Play" />
If I just have the below in the head it works:
Code:
function PlaySound(SongURL)
{
PopUp = window.open (SongURL, "width=200,height=30")
   }
Could I please get some help on the IF ELSE, or if there's a different route I should take? Thanks!
hominid4 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 01:42 AM.


Advertisement
Log in to turn off these ads.