Witam. Mam skrypt:
function submitForm(ktora,naw1,naw2)
{
var req = null;
if(window.XMLHttpRequest)
req = new XMLHttpRequest();
else if (window.ActiveXObject)
req = new ActiveXObject(Microsoft.XMLHTTP);
var e,n;
n1 = document.getElementById("nawigacja1");
n2 = document.getElementById("nawigacja2");
if(naw1 == "none")
n1.style.display = "none";
if(naw1 == "block")
n1.style.display = "block";
if(naw2 == "none")
n2.style.display = "none";
if(naw2 == "block")
n2.style.display = "block";
e = document.getElementById("szablony");
e.innerHTML = "<img id='ladowanie' alt='ladowanie' src='pliki/images/loading.gif' />";
req.onreadystatechange = function()
{
if(req.readyState == 4)
{
if(req.status == 200)
{
e.innerHTML = req.responseText;
}
else
{
e.innerHTML="Error I can't get more galery";
}
}
};
req.open("GET", "pliki/"+ktora, true);
req.send(null);
}
Wszystko działa poprawnie, lecz po kliknięciu przycisku cała strona przerzucana jest na początek. Co zrobić aby została w miejscu ? Próbowałem sposobu z tablicami i również ten sam efekt. Możliwe jest też ukrywanie warstw, ale niezbyt mi się to podoba, ponieważ cały czas musi się wczytywać cała strona z każdą warstwą.
P.s. poza tym w Validatorze wyskakuje błąd o następującej treści:
document type does not allow element "img" here …ie' src='pliki/images/loading.gif' />";
The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).
One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).