Vorheriges Thema: Nächstes Thema: |
Autor |
Nachricht |
Pädi
Anmeldungsdatum: 14.04.2010 Beiträge: 1
|
Verfasst am: 14.04.2010 15:15:42 Titel: Ausgabetext mit HTML-IFrame ersetzen |
|
|
Hallo zusammen
Ich habe ein kleines Problem. Ich möchte gerne die Ausgabetexte mit IFrames ersetzen. Wenn ich beispielsweise in den Dropdownlisten BMW M3 auswähle, sollte anstatt der Ausgabe "Text 11" ein iFrame bzw. Html eingebunden werden. Vielen Dank für eure Unterstützung.
Hier der gesamte Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" language="javascript">
var text_container = new Array(anzahl_kategorie);
text_container[0] = new Array("Text 0");
text_container[1] = new Array("-- Auswahl --",
"Text 13.",
"Text 14.",
"Text 15.",
"Text 16.",
"Text 17.",
"Text 18.",
"Text 19.");
text_container[2] = new Array("-- Auswahl --",
"Text 10.",
"Text 11.",
"Text 71.",
"Text 12.");
text_container[3] = new Array("-- Auswahl --",
"Text 7.",
"Text 8.",
"Text 9.",
"Text 92.");
text_container[4] = new Array("-- Auswahl --",
"Text 4.",
"Text 5.",
"Text 54.",
"Text 6.");
text_container[5] = new Array("-- Auswahl --",
"Text 1.",
"Text 2.",
"Text 28.",
"Text 3.");
var anzahl_kategorie = 7;
var optionenliste = new Array(anzahl_kategorie);
optionenliste[0] = new Array("-- Auswahl --");
optionenliste[1] = new Array("-- Auswahl --",
"A1",
"A2",
"A3",
"A4",
"A5",
"A6",
"A7");
optionenliste[2] = new Array("-- Auswahl --",
"M1",
"M3",
"X3",
"X5");
optionenliste[3] = new Array("-- Auswahl --",
"Mustang",
"Fusion",
"Mondeo",
"Fiesta");
optionenliste[4] = new Array("-- Auswahl --",
"Astra",
"Omega",
"Vectra",
"Manta");
optionenliste[5] = new Array("-- Auswahl --",
"MX5",
"MX3",
"RX5",
"RX8");
function auswahlwechsel()
{
for (loop = window.document.getElementById("auswahl_2").options.length-1; loop > 0; loop--)
{
window.document.getElementById("auswahl_2").options[loop] = null;
}
for (loop = 0; loop < optionenliste[window.document.getElementById("auswahl_1").selectedIndex].length; loop++)
{
window.document.getElementById("auswahl_2").options[loop] = new Option(optionenliste[window.document.getElementById("auswahl_1").selectedIndex][loop]);
}
window.getElementById.auswahl_2.selectedIndex = 0;
}
function textwechsel()
{
document.getElementById("ausgabe").innerHTML = text_container[window.document.getElementById("auswahl_1").selectedIndex][window.document.getElementById("auswahl_2").selectedIndex];
}
function set_orig()
{
window.getElementById.auswahl_1.selectedIndex = 0;
window.getElementById.auswahl_2.selectedIndex = 0;
}
window.onload = set_orig
// -->
</script>
</head>
<body>
<form>
<select id="auswahl_1" onchange="auswahlwechsel(); ">
<option>-- Auswahl --</option>
<option>Audi</option>
<option>BMW</option>
<option>Ford</option>
<option>Opel</option>
<option>Mazda</option>
</select>
<select id="auswahl_2" onchange="textwechsel();">
<option>-- Auswahl --</option>
<option></option>
<option></option>
</select>
<br />
<br />
<br />
<div id="ausgabe"></div>
</form>
</body>
</html> |
|
Nach oben |
|
|
Kambfhase Häufiger Poster
Anmeldungsdatum: 19.03.2006 Beiträge: 235
|
Verfasst am: 15.04.2010 16:54:30 Titel: |
|
|
Ich hab mich mal ran gesetzt den Code auszubessern. Ich habe dein Beispiel des M3 aufgegriffen und dort den iFrame eingefügt.
Code: |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form>
<select id="auswahl_1" onchange="auswahlwechsel();">
<option>-- Auswahl --</option>
<option>Audi</option>
<option>BMW</option>
<option>Ford</option>
<option>Opel</option>
<option>Mazda</option>
</select>
<select id="auswahl_2" onchange="textwechsel();">
<option>-- Auswahl --</option>
<option></option>
<option></option>
</select>
<br />
<br />
<br />
<div id="ausgabe"></div>
</form>
</body>
<script type="application/javascript" language="javascript">
var anzahl_kategorie = 7;
var text_container = ["Text 0"];
text_container[1] = ["-- Auswahl --","Text 13.","Text 14.","Text 15.","Text 16.","Text 17.","Text 18.","Text 19."]
text_container[2] = ["-- Auswahl --","Text 10.","<iframe src=\"\" />","Text 71.","Text 12."];
text_container[3] = ["-- Auswahl --","Text 7.","Text 8.","Text 9.","Text 92."];
text_container[4] = ["-- Auswahl --","Text 4.","Text 5.","Text 54.","Text 6."];
text_container[5] = ["-- Auswahl --","Text 1.","Text 2.","Text 28.","Text 3."];
var optionenliste = ["-- Auswahl --"];
optionenliste[1] = ["-- Auswahl --","A1","A2","A3","A4","A5","A6","A7"];
optionenliste[2] = ["-- Auswahl --","M1","M3","X3","X5"];
optionenliste[3] = ["-- Auswahl --","Mustang","Fusion","Mondeo","Fiesta"];
optionenliste[4] = ["-- Auswahl --","Astra","Omega","Vectra","Manta"];
optionenliste[5] = ["-- Auswahl --","MX5","MX3","RX5","RX8"];
var auswahl_1 = document.getElementById("auswahl_1"),
auswahl_2 = document.getElementById("auswahl_2");
function auswahlwechsel(){
var loop = auswahl_2.options.length-1;
for (; loop > 0; loop--){
auswahl_2.options[loop] = null;
}
for (loop = 0; loop < optionenliste[ auswahl_1.selectedIndex].length; loop++){
auswahl_2.options[loop] = new Option( optionenliste[ auswahl_1.selectedIndex][loop]);
}
auswahl_2.selectedIndex = 0;
}
function textwechsel(){
document.getElementById("ausgabe").innerHTML = text_container[ auswahl_1.selectedIndex][ auswahl_2.selectedIndex];
}
auswahl_1.selectedIndex = 0;
auswahl_1.selectedIndex = 0;
</script>
</html> |
MfG Hase |
|
Nach oben |
|
|
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
|
|