Hab das Problem gelöst.
Dachte ganze Zeit das ich das beim script Modal2 machen muss damit's funktioniert, dabei lags am btn2.
Code:
// Get the modal
var modal = document.getElementById("myModal");
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
var btn2 = document.getElementById("myBtn2");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks on the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
btn2.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
ich programmier momentan eine art Knowledge base und benutze dafür html, css und ein wenig js. Ich möchte nun ein pop up modal fenster einbauen und habe eine W3Schools Seite als Hilfestellung genutzt.
Link zum Code
Code:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial, Helvetica, sans-serif;}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<h2>Modal Example</h2>
<!-- Trigger/Open The Modal -->
<button id="myBtn">Open Modal</button>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span class="close">×</span>
<p>Some text in the Modal..</p>
</div>
</div>
<script>
// Get the modal
var modal = document.getElementById("myModal");
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</html>
Ich hab jetzt das Problem das ich mit diesem Code nur 1 pop up Fenster erstellen kann. Wenn ich versuche da was umzuschreiben, damit ich mehrere Pop up Fenster bekomme funktioniert es leider nicht.
Wäre nice wenn mir da jemand sagen könnte woran es liegt
Zeig uns doch dann mal die Code den du versuchst der Fehler verursacht, dann können wir dir besser helfen (:
Quote:
Originally Posted by OemG
Link zum Code
Code:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial, Helvetica, sans-serif;}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<h2>Modal Example</h2>
<!-- Trigger/Open The Modal -->
<button id="myBtn">Open Modal</button>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span class="close">×</span>
<p>Some text in the Modal..</p>
</div>
</div>
<script>
// Get the modal
var modal = document.getElementById("myModal");
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</html>
ich programmier momentan eine art Knowledge base und benutze dafür html, css und ein wenig js. Ich möchte nun ein pop up modal fenster einbauen und habe eine W3Schools Seite als Hilfestellung genutzt.
Link zum Code
Code:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial, Helvetica, sans-serif;}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<h2>Modal Example</h2>
<!-- Trigger/Open The Modal -->
<button id="myBtn">Open Modal</button>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span class="close">×</span>
<p>Some text in the Modal..</p>
</div>
</div>
<script>
// Get the modal
var modal = document.getElementById("myModal");
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</html>
Ich hab jetzt das Problem das ich mit diesem Code nur 1 pop up Fenster erstellen kann. Wenn ich versuche da was umzuschreiben, damit ich mehrere Pop up Fenster bekomme funktioniert es leider nicht.
Wäre nice wenn mir da jemand sagen könnte woran es liegt
Grüße,
OemG
Quote:
Originally Posted by False
Nicht wirklich der von dir verlinkte Code funktioniert ja für 1 Button.
Zeig mal dein Code wo du versucht hast 2 Modals zu öffnen.
Verstehst du den was der Code macht oder hast du den einfach nur kopiert?
jaein, verstehe nur halb was der js code macht. Ich hab halt sachen probiert wie
<button id="myBtn">xxx</button> umändern zu
<button id="myBtn2">xxx</button> und dazu im js script
var btn = document.getElementById("myBtn");
var btn2 = document.getElementById("myBtn2");
jaein, verstehe nur halb was der js code macht. Ich hab halt sachen probiert wie
<button id="myBtn">xxx</button> umändern zu
<button id="myBtn2">xxx</button> und dazu im js script
var btn = document.getElementById("myBtn");
var btn2 = document.getElementById("myBtn2");
Hab halt rum experimentiert ohne erfolg.
Na so wird das nichts. Da ich gerade Langeweile hatte, hier mein Code.
Btw. es ist nur eine Möglichkeit es zu machen. Es ist auch nicht eingebaut, dass wenn man neben das Modal klickt, es sich automatisch schließt.
[HTML] index.html? 04/06/2015 - Web Development - 3 Replies Hallo Elitepvpers,
ich entschuldige mich, dass hier schon wieder ein Thread von mir auftaucht. :o
Ich habe nun dank eurer Hilfe meine Welcome Page (http://www.elitepvpers.com/forum/web-development/ 3668375-html-welcome-page.html) fertiggestellt.
Nun meine Frage ist, ob es irgendwie eine Möglichkeit gibt, in einer Datei festzulegen, welche Datei aufgerufen wird (index.php/html ist es normalerweise), da ich noch eine "maintenance.html" Seite machen möchte, und nur in dieser Datei die...
html/javasript/html frage 08/03/2013 - Web Development - 8 Replies Heyho epvpers,
Ich hätte eine frage an euch über eine homepage.
Unswar wenn man so an links an die seite mit der Maus geht,kommt ein z.B. Teamspeak3 viewer rausgefahren und das wollte ich fragen wie ich das mache und eventuel mir einer da ein script schicken kann wäre nett.
Danke im vorraus!
Mit freundlichen grüßen:
Phillip
[Joomla][HTML] modul in einer html datei verlinken? 11/11/2011 - Web Development - 1 Replies ich hab vorher im joomla forum schon ein thread geöffnet aber da antwortet mir niemand und ich ich langsam keine gedult mehr.. will heute noch weiter probieren und so.
----------------------------------------
Bei den Modulen gibt es ein leeres, wo man ein editor hat. Ist es möglich eine verlinkung zum modul in der html zu machen?
Hier ein beispiel vom aufbau meiner website: Vorstellung wie die website ungefähr sein soll, wo ich welche div container gemacht habe, wie das ganze zur zeit...
[HTML]HELP[/HTML]range hack and skill speed in extreme 08/21/2009 - Dekaron Private Server - 5 Replies hey guys i need a little help about range hack and skill speed in extreme
i already unpack the Data its all done..1! my problem is wer i can edit the range ang skill speed in extreme..! pls :):):):):)