#1 (permalink)  
Old 05-13-2009, 10:57 AM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Like you, on a tiny speck of dust floating in the Virgo Cluster.
Posts: 1,311
Send a message via AIM to Leprakawn Send a message via Yahoo to Leprakawn
Dropdown menu - alert

Okay, I know the simple js alert script... such as
Code:
function show_alert()
{
alert("Luke, I am your father.");
}

onclick="show_alert()"
But does anyone here happen to have any suggestions for an alert via a dropdown menu? I have a dd menu with 18 items, and I would like to see if I can put an alert on one of the items.

Thanks for your help!
__________________
This field was intentionally left blank.


Wait a minute... oops.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

  #2 (permalink)  
Old 05-13-2009, 01:01 PM
Deadeye's Avatar
Moderator
 
Join Date: Aug 2005
Location: San Diego, CA
Posts: 296
Send a message via MSN to Deadeye
Code:
function show_alert(int index)
{
    if(index == 7)
    {
        alert("Luke, I am your father.");
    }
}

onChange="show_alert(this.index)"
something along these lines. I'm not 100% sure of the code since I havent touched JS in a long time. But this is how I would approach this problem.

Wesley
__________________
Don't forget to rate me A+++++++++++++++++!!!!!111one for the service you have received.
  #3 (permalink)  
Old 05-13-2009, 02:52 PM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Like you, on a tiny speck of dust floating in the Virgo Cluster.
Posts: 1,311
Send a message via AIM to Leprakawn Send a message via Yahoo to Leprakawn
I meant to say this in my prev post, but I left it out thinking it was not important to say... I tried all of the other "on" functions: onchange; onhelp; etc.

I found another site that seemed to have the same question, and it looks like that answer uses the value as the item to reference the alert. My issue with that is that my dd menu is a list of links; thus, putting the URL in the function will not work because of the // characters. However... maybe if I can use the html number to fix it...
__________________
This field was intentionally left blank.


Wait a minute... oops.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

Last edited by Leprakawn; 05-13-2009 at 09:25 PM..
  #4 (permalink)  
Old 05-13-2009, 03:44 PM
Deadeye's Avatar
Moderator
 
Join Date: Aug 2005
Location: San Diego, CA
Posts: 296
Send a message via MSN to Deadeye
oh, sorry about that.

How is your page built? PHP or just plain HTML/js?

Wesley
__________________
Don't forget to rate me A+++++++++++++++++!!!!!111one for the service you have received.
  #5 (permalink)  
Old 05-13-2009, 04:15 PM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Like you, on a tiny speck of dust floating in the Virgo Cluster.
Posts: 1,311
Send a message via AIM to Leprakawn Send a message via Yahoo to Leprakawn
I am here at work, so this one is HTML/CSS/JS straight up. No can do PHP.

EDIT:
Shoot... and with my previous idea of using the HTML number to fix / (& #47; Ğ no space), that is working, but I am not getting an alert. I do not know if this would be causing an issue, the link is opening in a secondary window, which it needs to do for security issues.

You know, if this is too complicated, I guess I should not worry about it. Hopefully the ppl know which item to select when they hit the particular link. If not, then they will have to try it again.
__________________
This field was intentionally left blank.


Wait a minute... oops.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

Last edited by Leprakawn; 05-13-2009 at 04:36 PM..
  #6 (permalink)  
Old 05-13-2009, 09:12 PM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,533
Any chance you can show us the code you're currently using? I'd be a lot more likely to be able to diagnose the issue if I could get my hands into the code.
__________________
I hate Internet Explorer! Anyone with me?
  #7 (permalink)  
Old 05-13-2009, 09:24 PM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Like you, on a tiny speck of dust floating in the Virgo Cluster.
Posts: 1,311
Send a message via AIM to Leprakawn Send a message via Yahoo to Leprakawn
Curtiss:

Here is the dd menu:
HTML Code:
<form name="el%20nombre"><div>
<select name="SelectURL" onchange="document.location.href=document.resources.SelectURL.options[document.resources.SelectURL.selectedIndex].value;" style="font-size:80%; width:100%; background:#000066; color:#fff; cursor:default;">
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="the URL I want to add the alert to">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option value="some random url">Link</option>
<option selected>Select Link</option>
</select></div></form>
The JS I have tried to use...
Code:
<script language="javascript" type="text/javascript">
function show_alert()
{
alert("Hi, I am the alert text.");
}
</script>

And I added this to the link of interest:
onchange="show_alert()"
As for the other trick I tried to use... I erased that code yesterday.
__________________
This field was intentionally left blank.


Wait a minute... oops.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

Last edited by Leprakawn; 05-14-2009 at 11:25 AM..
Closed Thread


Thread Tools
Display Modes 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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add values in a list menu pixelhouse Programming and Scripting 1 01-24-2009 09:27 PM
CSS and Java Script Menu - need help! SashaEndoh Programming and Scripting 2 07-15-2008 10:15 AM
Flash Menu Error bmarino Graphics and Flash 2 04-09-2007 12:19 AM
dropdown menu and firefox problems karen Browsers 1 06-25-2006 08:43 AM
Menu Bar Aligning ctbrons Programming and Scripting 8 04-13-2006 11:55 AM


All times are GMT -5. The time now is 04:44 PM.

 
Clicky Web Analytics
CloudContacts
Loop11
Page.ly


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.1 PL1
© 1997-2009 HTMLCenter