Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
wert = unescape(wert).replace("+", " ");
:
The escape() function was deprecated in JavaScript version 1.5. Use encodeURI () or encodeURIComponent() instead.
Ich weiß im Moment nicht so recht, wo wie und was. Deine Beiträge sind so lang. Kannst du das aktuelle Problem irgendwie kürzer fassen? Vielleicht auch Code online stellen zum probieren?
Wenn du hier eine vollständige Seite postest kopier ich mir die und probier es aus.
Vorher noch eine Frage: Steht was in der Browser Fehlerkonsole?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Testseite</title>
<script type="text/javascript" src="../../Main-Theme/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="../../Main-Theme/js/jquery.main.js"></script>
<script type="text/javascript" src="test.js"></script>
</head>
<body>
<div id="no-js" class="no-js">
<p class="no-js">Kein Javascript</p>
</div>
</body>
</html>
var wert="111", provider, id, link="";
var providerliste = [];
var linkliste = [];
var htmlStructure ="";
var linkStructure ="";
function Werteliste (querystring) {
if (querystring == '') return;
var wertestring = wertestring.slice(1);
var paare = wertestring.split("&");
var paar, name, wert;
for (var i = 0; i < paare.length; i++) {
paar = paare[i].split("=");
wert = paar[0];
wert = unescape(wert).replace("+", " ");
return wert;
}
}
$(document).ready(function()
{
//lets pickup the string into the location
//wert = new Werteliste(location.search);
//lets load our links
$.ajax(
{
type: "GET",
url: "links.xml",
dataType: "xml",
success: function(xml){
//lets do some reading
$(xml).find('provider').each(function()
{
provider = $(this).find("text").text();alert(provider);
console.log($(this).find("text").text());
// build a vissible container for each provider with default blured content and a invisible container, which will later contain the link, next to it
htmlStructure = htmlStructure + '<div id="'+provider+'_off_holder" style="width:300px;height:30px;display:block; background-image:url(../../Main-Theme/images/"'+provider+'"_logo.png); z-index:90;"><div id="'+provider+'"_content" style="width:100%;height:100%;"><p class="">ID '+wert+' nicht vorhanden.</p></div></div><div id="'+provider+'_on_holder" style="width:300px;height:30px;display:block; background-image:url(../../Main-Theme/images/"'+provider+'"_logo.png); z-index:90;"><div id="'+provider+'"_content" style="width:100%;height:100%;"> vorhanden </div></div>';
//replace the no-js-place-holder into the calling document
$(".no-js").html(htmlStructure);
$(this).find("option").each(function()
{
id = $(this).find("id").text();
if (id == wert)
{
link = $(this).find("link").text();//alert(link);//alert(provider);
console.log($(this).find("link").text());console.log(provider);
providerliste.push(provider); //stores the provider(s) name(s) which have the ID
linkliste.push(link); // stores the link(s)
}
});
});
for (i = 0; i < providerliste.length; i++)
{
// makes the default-blur-container invisible and the place-holder-container visible, for this providers, which have the ID
//$('."+providerliste[i]+"_off_holder').hide();
//document.getElementById(providerliste[i]+"_off_holder").style.display = "none";
//$('."+providerliste[i]+"_on_holder').show();
//document.getElementById(providerliste[i]+"_on_holder").style.display = "block";
// now we create for each link a new code, which will go into the placeholder into the providers-containers. to make the container clickable, we place an transparent picture over the container
linkStructure = linkStructure + '<a href="'+linkliste[i]+'" class=""><img src="http://forum.jswelt.de/Main-Theme/images/transparent.png" style="width:100%;height:100%;z-index:110;"></image>Test</a>';
//attach the links into the providers-containers
$("."+providerliste[i]+"_content").append(linkStructure);
// $("").html(linkstructure).appendTo(providerliste[i]+'_content');
}
},
error: function(response)
{
alert('Error loading XML data');
}
});
});
<div id="'+provider+'_on_holder" style="width:300px;height:30px;display:block; background-image:url(../../Main-Theme/images/"'+provider+'"_logo.png); z-index:90;"><div id="'+provider+'"_content" style="width:100%;height:100%;"> vorhanden </div></div>';
<div id="'+provider+'"_content" style="width:100%;height:100%;"> vorhanden </div>;
//attach the links into the providers-containers
$("."+providerliste[i]+"_content").append(linkStructure);
var wert="111", provider, id, link="";
'<div id="' + provider + '"_content" style="width:100%;height:100%;">'
ergibt z.B. '<div id="oboom"_content" style="width:100%;height:100%;">'
. Dort ist ein "
zuviel."' + provider + '"_content"'
zwei mal, was verboten ist, da eine ID ein eindeutiger Bezeichner sein muss.$("." + providerliste[i] + "_content").append(linkStructure);
nach einer Klasse und nicht nach einer ID.htmlStructure = htmlStructure + '...';
sein soll? Besser for der .each()
-Funktion das HTML löschen und mit .append()
-Funktion arbeiten.Das kommt davon, wenn der Code nicht übersichtlich formatiert wird, denn in folgender Passage (Formatiert)Mit dem Hochkamma hast du recht, war ein Fehler, bei der Behauptung, die ID sei doppelt möchte ich widersprechen, denn '"+provider+" ist ja eine Variable, die sich ändert,
es sollte also einmal "oboom_content" und einmal "longfiles_content" entstehen und somit nicht doppelt sein, oder habe ich da wad übersehen?
// build a vissible container for each provider with default blured content and a invisible container, which will later contain the link, next to it
htmlStructure = htmlStructure +
'<div id="' + provider + '_off_holder" style="width:300px;height:30px;display:block; background-image:url(../../Main-Theme/images/"' + provider + '"_logo.png); z-index:90;">' +
'<div id="' + provider + '_content" style="width:100%;height:100%;">' +
'<p class="">ID ' + wert + ' nicht vorhanden.</p>' +
'</div>' +
'</div>' +
'<div id="' + provider + '_on_holder" style="width:300px;height:30px;display:block; background-image:url(../../Main-Theme/images/"' + provider + '"_logo.png); z-index:90;">' +
'<div id="' + provider + '_content" style="width:100%;height:100%;">' +
' vorhanden ' +
'</div>' +
'</div>';
<div id="' + provider + '_content" style="width:100%;height:100%;">
. Das erste Mal im DIV-Lomtainer id="' + provider + '_off_holder" und das zweite Mal im DIV-Lomtainer id="' + provider + '_on_holder"Mit dem ID-Selector #, so wie bei CSS (Stylesheet):Wie könnte ich denn richtig nach einer ID, anstatt nach einer Klasse suchen?
$("#" + providerliste[i] + "_content").append(linkStructure);
Dann solltest du das schleunigst mal nachholen, zumal du es weiter unten im Code soger in Verwendung hastPs: das html-structure soll die Container erzeugen, da ich mit append nicht ganz so firm bin.
success: function (xml) {
//lets do some reading
$(xml).find('provider').each(function () {
provider = $(this).find("text").text();
alert(provider);
console.log($(this).find("text").text());
// build a vissible container for each provider with default blured content and a invisible container, which will later contain the link, next to it
htmlStructure = htmlStructure +
'<div id="' + provider + '_off_holder" style="width:300px;height:30px;display:block; background-image:url(../../Main-Theme/images/"' + provider + '"_logo.png); z-index:90;">' +
'<div id="' + provider + '_content" style="width:100%;height:100%;">' +
'<p class="">ID ' + wert + ' nicht vorhanden.</p>' +
'</div>' +
'</div>' +
'<div id="' + provider + '_on_holder" style="width:300px;height:30px;display:block; background-image:url(../../Main-Theme/images/"' + provider + '"_logo.png); z-index:90;">' +
'<div id="' + provider + '_content" style="width:100%;height:100%;">' +
' vorhanden ' +
'</div>' +
'</div>';
$(this).find("option").each(function () {
id = $(this).find("id").text();
if (id == wert) {
link = $(this).find("link").text(); //alert(link);//alert(provider);
console.log($(this).find("link").text());
console.log(provider);
providerliste.push(provider); //stores the provider(s) name(s) which have the ID
linkliste.push(link); // stores the link(s)
}
});
});
//replace the no-js-place-holder into the calling document <<< NUR EIN AUFRUF
$(".no-js").html(htmlStructure);
...
dein weiterer Code bis Funktionsende
...
},
success: function (xml) {
//lets do some reading
$(xml).find('provider').each(function () {
provider = $(this).find("text").text();
alert(provider);
console.log($(this).find("text").text());
//delete content of the no-js-place-holder
$(".no-js").html("");
// build a vissible container for each provider with default blured content and a invisible container, which will later contain the link, next to it
// AND apend html structure the no-js-place-holder
$(".no-js").append('<div id="' + provider + '_off_holder" style="width:300px;height:30px;display:block; background-image:url(../../Main-Theme/images/"' + provider + '"_logo.png); z-index:90;">' +
'<div id="' + provider + '_content" style="width:100%;height:100%;">' +
'<p class="">ID ' + wert + ' nicht vorhanden.</p>' +
'</div>' +
'</div>' +
'<div id="' + provider + '_on_holder" style="width:300px;height:30px;display:block; background-image:url(../../Main-Theme/images/"' + provider + '"_logo.png); z-index:90;">' +
'<div id="' + provider + '_content" style="width:100%;height:100%;">' +
' vorhanden ' +
'</div>' +
'</div>');
$(this).find("option").each(function () {
id = $(this).find("id").text();
if (id == wert) {
link = $(this).find("link").text(); //alert(link);//alert(provider);
console.log($(this).find("link").text());
console.log(provider);
providerliste.push(provider); //stores the provider(s) name(s) which have the ID
linkliste.push(link); // stores the link(s)
}
});
});
...
dein weiterer Code bis Funktionsende
...
},
oder eben mit jQuery .append()
//delete content of the no-js-place-holder
$("#no-js").html("");
success: function (xml) {
//delete content of the no-js-place-holder
$("#no-js").html("");
//lets do some reading
$(xml).find('provider').each(function () {
provider = $(this).find("text").text();
console.log($(this).find("text").text());
// build a vissible container for each provider with default blured content and a invisible container, which will later contain the link, next to it
// AND apend html structure the no-js-place-holder
// thanks to miniA4kuser @ forum.jswelt
$("#no-js").append('<div id="' + provider + '_off_holder" style="width:300px;height:30px;display:block; background-image:url(../../Main-Theme/images/"' + provider + '"_logo.png); z-index:90;">' +
'<div id="' + provider + '_nocontent" style="width:100%;height:100%;">' +
'<p class="">ID ' + wert + ' bei Anbieter ' + provider + ' nicht vorhanden.</p>' +
'</div>' +
'</div>' +
'<div id="' + provider + '_on_holder" style="width:300px;height:30px;display:none; background-image:url(../../Main-Theme/images/"' + provider + '"_logo.png); z-index:90;">' +
'<div id="' + provider + '_content" style="width:100%;height:100%;">' +
'<p class=""> </p>' +
'</div>' +
'</div>');
.each()
und nicht innerhalb.Richtig erkannt, das muß natürlich for das.each()
und nicht innerhalb.