Dateigrösse: 3.09 kb
1 <?php 2 function erzeugeSelect($sel_name,$arr,$sel_item,$first='',$auto_submit='1') { 3 $menu = '<select name="'.$sel_name.'" size="1"'; 4 $menu .= $auto_submit == '1' ? ' onchange="this.form.submit();" onfocus="this.style.backgroundColor=\'#ffffff\'" >'."\n" : '>'."\n"; 5 $menu .= $first == '' ? '' : '<option value="-1">'.$first.'</option>'."\n"; 6 7 foreach ($arr as $schluessel => $wert) 8 { 9 $selected = $sel_item == $schluessel ? ' selected="selected"' : ''; 10 $menu .= '<option value="'.$schluessel.'"'. $selected.'>'.$wert.'</option>'."\n"; 11 } 12 $menu .= '</select>'."\n"; 13 return $menu; 14 } 15 ?> 16 17 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 18 <html> 19 <head> 20 <title>DaF-Uebungen:::Aufklapp-Menu</title> 21 <meta name="keywords" content="DaF, Fremdsprache Deutsch, Lueckentext, Grammatiktest, Deutschtest, Test, Multiple Choice, Michael Steiner, EB, EB Zürich"> 22 23 <link rel="SHORTCUT ICON" href="../img/favicon.ico" title="external:/favicon.ico"> 24 25 <style type="text/css"> 26 body { background-color:#f8f8ff; font-family:verdana,arial; font-size:12px; padding:0px; padding-top:0px; margin:0px; overflow:hidden; } 27 #header { position:absolute; top:0px; left:0px; width:240px; padding: 10px 0px 0px 33px; margin: 0px; font-size: 12px; font-weight: bold; background-color:transparent; z-index:15; } 28 #sel_test { position:absolute; top:0px; left:240px; width:300px; padding: 5px 0px; margin: 0px; font-size: 12px; background-color:transparent; z-index:10; } 29 iframe { position:absolute; top:25px; left:0px; width:100%; height:100%; border-top:1px solid #000000; padding: 0px; background-color: #ffffff; margin:0px; z-index:5; } 30 form { margin:0px; padding:0px; } 31 #sel_test select { font-family:verdana; font-size:12px; background-color:yellow; border:1px solid #000000; font-weight: bold; letter-spacing:1.5px; } 32 </style> 33 34 </head> 35 36 <body> 37 38 <?php 39 $sel_name = 'uebungen'; 40 $arr = array( 41 "gegenteil.php" => "Adjektive ::: Gegenteil", 42 "adjektivendung.php" => "Adjektive ::: Endungen", 43 "rb.php" => "Multiple Choice Test", 44 "perfekt.php" => "Perfekt I", 45 "perfekt_2.php" => "Perfekt II", 46 "artikel.php" => "Artikel", 47 "kueche_einrichten.php" => "Tischlein deck' dich !", 48 "papamoll_ddrop.php" => "Papa Moll", 49 ); 50 $sel_item = isset($_POST['uebungen']) ? $_POST['uebungen'] : 'perfekt.php'; 51 52 $n = '<div id="sel_test">'; 53 $n .= '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="n">'; 54 $n .= erzeugeSelect($sel_name,$arr,$sel_item); 55 $n .= '</form>'; 56 $n .= '</div>'; 57 echo $n; 58 echo '<br><br>'; 59 ?> 60 61 <div id="header">Wählen Sie eine neue Übung:</div> 62 63 <iframe name="iframe" width="100%" src="<?php echo $sel_item; ?>" scrolling="auto" frameborder="0"> 64 <p>Ihr Browser kann leider keine eingebetteten Frames anzeigen:<br><br> 65 Sie können die eingebettete Seite über den folgenden Verweis 66 aufrufen: <a href="<?php echo $sel_item; ?>"><?php echo $arr[$sel_item]; ?></a></p> 67 </iframe> 68 69 </body> 70 </html> 71