|
You last visited: Today at 09:10
Advertisement
Function mit Select auswählen?
Discussion on Function mit Select auswählen? within the Web Development forum part of the Coders Den category.
07/18/2019, 20:24
|
#1
|
elite*gold: 0
Join Date: Feb 2012
Posts: 935
Received Thanks: 110
|
Function mit Select auswählen?
Hallo,
ich bin gerade dabei JS, xHtml etc. zu lernen.
Habe eine Function geschrieben die mir per Button eine Tabelle ausspuckt. Die klappt auch wunderbar.
Wollte das jetzt weiterführen. Und eine weitere Function schreiben die mir eine andere Tabelle ausgibt.
Diese wollte ich dann im Body bereich mit select/option auswählen und per Button bestätigen damit er die jeweilige Tabelle anzeigt.
Quote:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="UTF-8" /> <title>Seitentitel</title>
<script type="text/javascript"> //<![CDATA[
function BIP ()
{
var i;
var ausgabe;
var Laender = [ "Baden-Württemberg", "Bayern", "Hessen", "Niedersachsen", "NRW", "Rheinland-Pflaz", "Saarland", "Schleswig-Holstein", "Brandenburg", "Mecklbg.-Vorp.", "Sachsen", "Sachsen Anhalt", "Thüringen", "Berlin", "Bremen", "Hamburg", ];
var Zahlen = [ "28305", "23112", "21356", "73192", "23799", "21387", "2163", "8797897", "789789", "1244636", "153251", "123124", "0", "423543", "455435", "231313" ];
ausgabe ="<table border='1' style ='border:2px solid;'><tr><th> Länder </th>" + "<th> Brutto-Inlandsprodukt</th></tr>";
i=0;
do{ ausgabe = ausgabe + "<tr> <td>"+Laender[i] + "</td>"+"<td>"+ Zahlen[i]+"</td> </tr>";
i = i +1 ; }
while (i < Laender.length);
document.getElementById("tab1").innerHTML = ausgabe + "</table>"
}
//]]>></script>
</head>
<body>
<input type="button" value="Klick" onclick="BIP ()" />
<p id="tab1"></p>
</body>
</html>
|
So sieht mein script aus (die zweite function ist noch nicht geschrieben, kommt aber noch). Wie baue ich jetzt mein select/option ein. Habe vieles probiert kam aber leider nie zum Ergebnis.
|
|
|
07/19/2019, 18:07
|
#2
|
elite*gold: 0
Join Date: Oct 2007
Posts: 93
Received Thanks: 15
|
Wieso xhtml ?
Naja meinst du sowas ?
Quote:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Seitentitel</title>
</head>
<body>
<div>
<input type="button" value="Klick" onclick="BIP()" />
</div>
<input onclick="selectBox(1)" id="cb1" type="checkbox" />
<input onclick="selectBox(2)" id="cb2" type="checkbox" />
<div id="tab1"></div>
<script>
var i;
var ausgabe;
var ausgabe2;
var Laender = [
'Baden-Württemberg',
'Bayern',
'Hessen',
'Niedersachsen',
'NRW',
'Rheinland-Pflaz',
'Saarland',
'Schleswig-Holstein',
'Brandenburg',
'Mecklbg.-Vorp.',
'Sachsen',
'Sachsen Anhalt',
'Thüringen',
'Berlin',
'Bremen',
'Hamburg'
];
var Zahlen = [
'28305',
'23112',
'21356',
'73192',
'23799',
'21387',
'2163',
'8797897',
'789789',
'1244636',
'153251',
'123124',
'0',
'423543',
'455435',
'231313'
];
ausgabe =
"<table border='1' style ='border:2px solid;'><tr><th> Länder </th>" +
'<th> Brutto-Inlandsprodukt</th></tr>';
i = 0;
do {
ausgabe += `<tr> <td> ${Laender[i]} </td> <td> ${Zahlen[i]}</td> </tr>`;
i = i + 1;
} while (i < Laender.length);
ausgabe += '</table>';
ausgabe2 = `
<table>
<tr>
<td>Hallo</td>
<td>Mimimi</td>
</tr>
<tr>
<td>GG</td>
<td>BLA</td>
</tr>
</table>
`;
function BIP() {
document.getElementById('tab1').innerHTML =
document.getElementById('cb1').checked ? ausgabe : ausgabe2;
}
function selectBox(value) {
if (value == 1) document.getElementById('cb2').checked = false;
else document.getElementById('cb1').checked = false;
}
</script>
</body>
</html>
|
|
|
|
 |
Similar Threads
|
[Help]Select monster function
07/28/2017 - Flyff Private Server - 2 Replies
what function that select monster ??
:handsdown::handsdown:
|
std::function of a function returning an std::function
11/11/2013 - C/C++ - 19 Replies
Nun muss ich nach langer Zeit auch mal wieder einen Thread erstellen, weil mir Google nicht mehr weiterhelfen kann.
Ich verzweifle an Folgendem Vorhaben:
#include <Windows.h>
#include <string>
#include <iostream>
using namespace std;
|
Running Function 2 after Function 1 finished
09/15/2013 - AutoIt - 3 Replies
Hey, its me again.
Im stuck on a problem since yesterday and as much as i hate to ask for help, i really dont know what else to try. I want Function 2 to run after Function 1 has finished. I tried GuiCtrlSetOnEvent and MsgLoop, but i dont really understand it. I tried to read tutorials but they didnt help at all.
The line that are underline is what im talking about. I want gamestart() to run first and when its finished, i want iniviteteam() to run.
#AutoIt3Wrapper_UseX64=n...
|
Metin 2 Select Character select error
02/26/2011 - Metin2 Private Server - 1 Replies
Dabei-ist das spiel Charakter-Auswahl Error help
Log Files
0225 23:37:16227 :: CEffectManager::RegisterEffect - LoadScript(d:/ymir work/effect/hit/percent_damage1.mse) Error
0225 23:37:16227 :: CInstanceBase::RegisterEffect(eEftType=264, c_szEftAttachBone=, c_szEftName=d:/ymir work/effect/hit/percent_damage1.mse, isCache=1) - Error
0225 23:37:16227 :: CEffectManager::RegisterEffect - LoadScript(d:/ymir work/effect/hit/percent_damage2.mse) Error
0225 23:37:16227 ::...
|
[VIP-function] ToxicSYS [VIP-function]
08/14/2010 - WarRock Hacks, Bots, Cheats & Exploits - 1 Replies
heeeey E-pvpers :pimp:
this is a new hack by TSYS
Status : UNDETECTED
Functions (VIDEO) :
YouTube - WarRock - Bikini event VIP hack
|
All times are GMT +1. The time now is 09:10.
|
|