|
|||
Jquery Select und Option
Hallo zusammen, ich versuche mich mit JQuery für eine Selektion.
Jedoch tauchen zwei Probleme auf: 1. Wie bringe ich es fertig, dass man auch die erste <option> anklicken kann und sich der Link öffnet? 2. Wie stelle ich es an, dass die Auswahl der Select Box nicht automatisch die letzte Position wählt, sonder die erste? (Nur im Mozilla ein Problem) Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="jquery-1.3.2.min.js" type="text/javascript"></script> <script src="jquery.tools.min.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="overlay-minimal.css"> <style type="text/css"> body { padding:1em; /* background-color:#225588; */ color:white; } h1 { text-align:center; background-color:#aaddff; color:black; padding:0.5em; margin-left:0.5em; margin-right:0.5em; } div a { color:black; } div.submenu { position:relative; width:6em; padding:0.5em; background-color:transparent; border:none; } div#content{ background-color:white; color:black; /* margin-left:15em; margin-right:9em; */ padding:0.7em; width:313px; border:solid 1px #CCCCCC; font-family:Arial, Helvetica, sans-serif; font-size:12px; height:69px!important; *width:329px; } select { width:175px; vertical-align:top; } select.ajax1 { font-size:12px; } select.ajax2 { width:120px; font-size:12px; } } h2 { margin-top:-8px !important; } </style> <script type="text/javascript"> $(document).ready(function(){ $("div.submenu").hide(); $("div.menu").bind("mouseenter", function(){ $(this).children(".submenu").slideDown("slow"); }); $("div.menu").bind("mouseleave", function(){ $(this).children(".submenu").slideUp("slow"); }); $("select[name=ajax1]").change(function(){ var kontinent = $(this).children(":selected").text(); kontinent = kontinent.toLowerCase(); var datei = kontinent + ".html"; $("select[name=ajax2]").load(datei + " option"); }); $("button[rel]").overlay({ effect:"apple", speed:1500, preload:true, fadeInSpeed:5000, expose:{ color:"#002244", opacity:0.5, loadSpeed:1500, closeSpeed:1500 } }); }); </script> </head> <body> <p></p> <div id="content"><strong>Suche </strong>Farbwahl<br/> <br/> <select name="ajax1" size="1" class="ajax1"> <option SELECTED value="wählen sie ihre Farbe">Wählen Sie Ihre Farbe...</option> <option>Rot</option> <option>Grün</option> <option>Blau</option> </select> <select onChange="window.location.href=this.options [this.selectedIndex].value" name="ajax2" size="1" class="ajax2"> <option></option> </select> <br/> <br> </div> </body> </html> Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript"> function Go (select) { var wert = select.options[select.options.selectedIndex].value; if (wert == "leer") { select.form.reset(); parent.frames["unten"].focus(); return; } else { if (wert == "ende") { top.location.href = parent.frames[1].location.href; } else { parent.frames["unten"].location.href = wert; select.form.reset(); parent.frames["unten"].focus(); } } } </script> </head> <body> <select onChange="window.location.href=this.options [this.selectedIndex].value"> <option VALUE="http://rot.de">Rot</option> <option VALUE="http://dunkelrot.de">Dunkelrot</option> <option VALUE="http://hellrot.de">Hellrot</option> </select> </body> </html> Geändert von 123merlin (19.11.2009 um 20:01 Uhr) |
Sponsored Links |
Themen-Optionen | |
Ansicht | |
|
|
Ähnliche Themen | ||||
Thema | Autor | Forum | Antworten | Letzter Beitrag |
jQuery DropDown select auswählen | Jure | Javascript & Ajax | 3 | 24.11.2010 09:32 |
2x select boxen sollen option tauchen.(Javascript) | Don Roberto | Javascript & Ajax | 4 | 28.12.2009 22:01 |
Problem mit select option | phplerin | Serveradministration und serverseitige Scripte | 10 | 03.02.2009 18:18 |
jQuery: Select option und click | Sonny Lane | Javascript & Ajax | 3 | 17.12.2008 11:09 |
Select - Option disablen | CorinG | Javascript & Ajax | 11 | 29.07.2008 23:18 |