• Das Erstellen neuer Accounts wurde ausgesetzt. Bei berechtigtem Interesse bitte Kontaktaufnahme über die üblichen Wege. Beste Grüße der Admin

Thema: Sitzplan

görl

New member
Hallo Leute.

Wie Ihr seht bin ich ein Neuling hier, genau so bin ich auch ein Neuling was JS betrifft. :)

Ich habe einen Sitzplan erstellt mit Hilfe von einer Datenbank. Hier sind die PHP-Codes:

PHP:
<?php
include ("class_db.php");

$planID = 2;

$db = new DB("localhost", "", "", "plaene");
$db->query("TRUNCATE TABLE sitzplan_{$planID}");



for ($row=1; $row<=9; $row++)
{
	$x = (($row-1) * 22);
	setRow($x+1, $x+11, $row, "Links", 1);			setRow($x+12, $x+22, $row, "Rechts", 2);
	
}

function setRow($von, $bis, $reihe, $block, $kategorie)
{
	global $db, $planID;
	for($i=$von; $i<=$bis; $i++)
	{
		$db->query("INSERT INTO sitzplan_{$planID} SET
					sitz = '{$i}',
					reihe = '{$reihe}',
					block = '{$block}',
					kategorie = '{$kategorie}'");
	}
}

?>

PHP:
<?php
include ("class_db.php");

$planID = 2;

$db = new DB("localhost", "", "", "plaene");

$daten = $db->getQueryData("SELECT * FROM sitzplan_{$planID}");
//p($plandaten);

?>

<html>
	<head>
		<title>Sitzplan <?php echo $planID?></title>
			<style>
				.buehne {
					border: 2px solid black;
					width:600px;
					height:100px;
					margin:10px auto;
					background-color:#D3D3D3;
				}
				h1{
					text-align:center;
					font-size:40px;
					margin-top: 17px;
				} 
				.plan {
					border-collapse: collapse;
					border-width: 5px;
					text-align: center;
					margin: 20px auto;
				}
				.sitz {
					width:35px;
					height:35px;
					border-style:solid;
				}
				.row {
					width:35px;
					height:35px;
					border:dotted;
					background-color: #9370DB;
				}
				.cat1 {
				background-color: #3CB371;
			}
			.cat2 {
				background-color: #FF4500;
			}
			h2 {
				float: left;
				margin-left: 350px;
				margin-top:50px;
				font-size:30;
				color: #3CB371;
			}
			h3 {
				float:right;
				margin-right:350px;
				margin-top:50px;
				font-size:30;
				color:#FF4500;
			}
			h4 {
				margin:0 auto;
				font-size:30px;
				text-align:center;
				border: 2px double black;
				width:130px;
				height:40px;
				background-color:#00BFFF;
				color:white;
			}
			</style>
	</head>
<body>
	<div class = "buehne">
		<h1>Bühne</h1>
	</div>
	<table class="plan" id="plan">
		<?php
			$i=0;
			for($row=1; $row<=8; $row++)
			{
				echo "<tr>";
					for($seat=1; $seat<=22; $seat++)
					{
					if ($seat == 12) 
						echo "<td class='row'>" .$row ."</td>"; 
					
						$sitzdaten = $daten[$i];
						echo "<td class='sitz cat{$sitzdaten['kategorie']}'>{$sitzdaten['sitz']}</td>";
						$i++;
					}
				echo "</tr>";
			}
		?>
		</table>
		
	<h2>Links</h2>
	<h3>Rechts</h3>
	<h4>Eingang</h4>
</body>
</html>

Meine Frage:
Wie kann ich (mit Hilfe JS) eine Information unten einblenden lassen, wenn ich zB auf Sitznummer 23 anklicke. Ich hab gelesen, das mit "alert" ein "Fensterchen" auftaucht, aber ich möchte das diese Infos unter dem Sitzplan eingeblendet werden.

Ich hoffe ich hab mein Problem verständlich beschrieben! Danke!:)
 
Zurück
Oben