Hi i need some Help
I wrote a JavaScript code for Back-Button but with no success, i dont know what i have done wrong
the Back-Button doesnt show.
thanx
Javascript-code:
var hist = [];
$(document).ready(function(){ // dieser Code wird ausgeführt, wenn das HTML-Dokument
// geladen – also das DOM fertig aufgebaut – ist.
loadPage();
});
function loadPage(url){
$('#tabscontainer').load(function(){
var title = 'Back!';
hist.unshift({'url':url, 'title':title}); //Fügt am Anfang eines Arrays ein oder mehrere neue Elemente ein.
//Erwartet als Parameter die einzufügenden Elemente. Gibt die neue Elementzahl des Arrays zurück.
if(hist.length > 1){ // if there is more than one object in the hist array, we need to add a button to the header.
$('#header').append('<div class="leftButton">'+title+'</div>');
$('#header .leftButton').click(function(){ // after the page loads and the user clicks to go back, the code inside this function will run.
var thisPage = hist.shift(); //Entfernt das erste Element aus einem Array. Die nachfolgenden Elemente rücken entsprechend
//nach vorne. Das bisher zweite Element wird das neue erste usw. Gibt das entfernte Element zurück.
var previousPage = hist.shift();
loadPage(previousPage.url);
});
}
});
}
css-code:
#header div.leftButton {
display:block;
width: 35px;
height: 30px;
margin: 15px;
font-weight: bold;
text-align: center;
color: white;
max-width: 50px;
text-shadow: rgba(0,0,0,0.6) 0px -1px 0px;
border-width: 0 8px 0 14px;
-webkit-border-image: url(img/back_button.png) 0 8 0 14;
}


