MagierJack
Neues Mitglied
Könntest du mir einen Vorschlag machen? CSS, ich weiß, was es ist, aber nicht, wie mann es bedient!
Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
<script type="text/javascript">
window.onload = function()
{
var divs = document.querySelector(".job_motivation .bar_perc");
i = 0;
for (i = 0; i < divs.length; i++) {
if (divs[i].className == "bar_perc") {
alert(divs[i].firstChild.nodeValue);
break;
}
}
}
</script>
<div class="job_motivation"><span class="bar_perc">das hier</span></div>
<script>
var el = document.querySelector(".job_motivation .bar_perc");
alert(el);
</script>
<table class="bars">
<tbody><tr class="job_value">
<td><img src="images/job/dollar.png" alt=""> </td>
<td><div class="bar">
<div class="bar_fill" style="width: 38px;"></div>
<div class="bar_perc">25%</div>
</div></td>
</tr>
<tr class="job_exp">
<td><img src="images/job/experience.png" alt=""> </td>
<td><div class="bar">
<div class="bar_fill" style="width: 11px;"></div>
<div class="bar_perc">7%</div>
</div></td>
</tr>
<tr class="job_luck">
<td><img src="images/job/luck.png" alt=""> </td>
<td><div class="bar">
<div class="bar_fill" style="width: 12px;"></div>
<div class="bar_perc">8%</div>
</div></td>
</tr>
<tr class="job_danger">
<td><img src="images/job/danger.png" alt=""> </td>
<td><div class="bar">
<div class="bar_fill" style="width: 6px;"></div>
<div class="bar_perc">4%</div>
</div></td>
</tr>
<tr class="job_motivation">
<td><img src="images/job/motivation.png" alt=""> </td>
<td><div class="bar">
<div class="bar_fill" style="width: 150px;"></div>
<div class="bar_perc">[COLOR=Red]100%[/COLOR]</div>
</div>
[COLOR=#800000]<script type=[COLOR=#0000FF]"text/javascript"[/COLOR]>[/COLOR]
window.onload = function()
{
var divs = document.getElementsByTagName('div'),
i = 0;
for (i = 0; i [COLOR=#000080]< divs.length; i++) {
if (divs[i].className == 'bar_perc') {
alert(divs[i].firstChild.nodeValue);
break;
}
}
}
</script>[/COLOR]
Doch das geht!Der geht nicht!
querySelector
Returns the first matching Element node within the node's subtree. If no matching node is found, null is returned.
querySelectorAll
Returns a NodeList containing all matching Element nodes within the node's subtree, or an empty NodeList if no matches are found.
querySelector
Gibt das erste passende Element-Knoten innerhalb des Knotens Teilbaum. Wenn kein passender Knoten gefunden, wird null zurückgegeben.
querySelectorAll
Liefert eine NodeList enthält alle passenden Element-Knoten innerhalb des Knotens Teilbaum oder eine leere NodeList, wenn keine Übereinstimmungen gefunden werden.
</tr>
<tr class="[COLOR=Blue]job_motivation[/COLOR]">
<td><img src="images/job/motivation.png" alt=""> </td>
<td><div class="bar">
<div class="bar_fill" style="width: 150px;"></div>
<div class="[COLOR=RoyalBlue]bar_perc[/COLOR]">[COLOR=Red]100%[/COLOR]</div>
</div>
<div class="job_motivation">
<div class="bar">
<div class="bar_fill" style="width: 150px;"></div>
<div class="bar_perc">100%</div>
</div>
</div>
<script type="text/javascript" >
var el = document.querySelector(".job_motivation .bar_perc");
alert(el);
</script>
<html>
...
<head>
<script type="text/javascript" >
var el = document.querySelector(".job_motivation .bar_perc");
alert(el);
</script>
</head>
<body>
<div class="job_motivation">
<div class="bar">
<div class="bar_fill" style="width: 150px;"></div>
<div class="bar_perc">100%</div>
</div>
</div>
[CODE]
<tr class="job_motivation">
<td><img src="images/job/motivation.png" alt=""> </td>
<td><div class="bar">
<div class="bar_fill" style="width: 150px;"></div>
<div class="bar_perc">100%></div>
</div>
[/CODE]
</body>
</html>