Mam takie pytanko. Da sie za pomoca czystego HTML badz prostego skryptu javy script zrobic cus takiego :
Mamy dwie tabele. Zalozmy menu oraz text. W tabeli menu sa gify jako linki do stron. I teraz najezdzajac (on mouse over) na dany gif (link) w tabeli drugiej czyli text pojawil sie tekst. Czyli majac gifa np. Strona glowna, w tabeli text pojawil sie napis strona glowna. Majac gif 'newsy' w tabeli drugiej pojawil sie napis newsy itd...
[pomoc] onmouseover
Re: [pomoc] onmouseover
[xml]
<head><script type="text/javascript">
function tresc(d, a) {
if(d)
document.getElementById("foobar").innerHTML="foo"+a;
else
document.getElementById("foobar").innerHTML="";
}
</script>
</head>
<body>
<div>
<a href="#" onMouseOver="tresc(true, 1); return true;" onMouseOut="tresc(false, 1); return true;">aaa</a><br>
<a href="#" onMouseOver="tresc(true, 2); return true;" onMouseOut="tresc(false, 2); return true;">bbb</a><br>
<a href="#" onMouseOver="tresc(true, 3); return true;" onMouseOut="tresc(false, 3); return true;">ccc</a><br>
</div>
<div id="foobar" style="height: 30px;">
</div>
</body>
[/xml]
O coś takiego chodzi?
<head><script type="text/javascript">
function tresc(d, a) {
if(d)
document.getElementById("foobar").innerHTML="foo"+a;
else
document.getElementById("foobar").innerHTML="";
}
</script>
</head>
<body>
<div>
<a href="#" onMouseOver="tresc(true, 1); return true;" onMouseOut="tresc(false, 1); return true;">aaa</a><br>
<a href="#" onMouseOver="tresc(true, 2); return true;" onMouseOut="tresc(false, 2); return true;">bbb</a><br>
<a href="#" onMouseOver="tresc(true, 3); return true;" onMouseOut="tresc(false, 3); return true;">ccc</a><br>
</div>
<div id="foobar" style="height: 30px;">
</div>
</body>
[/xml]
O coś takiego chodzi?
Re: [pomoc] onmouseover
no mniej wiecej o cos takiego tyle tylko, zeby ten napis pojawial sie w tabeli, oraz nie brzmial foo1, foo2, foo3 tylko np. strona glowna, newsy itd.
Jak dobrze wyczailem ten kod, ktory napisales to tekst wyswietlany jest przez:
document.getElementById("foobar").innerHTML="foo"+a;
no ale sam nie wiem jak to zrobic, wiec moze pomoglbys mi jeszcze?
Jak dobrze wyczailem ten kod, ktory napisales to tekst wyswietlany jest przez:
document.getElementById("foobar").innerHTML="foo"+a;
no ale sam nie wiem jak to zrobic, wiec moze pomoglbys mi jeszcze?
Re: [pomoc] onmouseover
[xml]<head><script type="text/javascript">
function tresc(d, a) {
if(d)
document.getElementById("foobar").innerHTML=a;
else
document.getElementById("foobar").innerHTML="";
}
</script>
</head>
<body>
<div>
<a href="#" onMouseOver="tresc(true, 'Strona Głowna'); return true;" onMouseOut="tresc(false, 1); return true;"> aaa </a> <br>
<a href="#" onMouseOver="tresc(true, 'nEWSY'); return true;" onMouseOut="tresc(false, 2); return true;"> bbb </a> <br>
<a href="#" onMouseOver="tresc(true, 'Itd.'); return true;" onMouseOut="tresc(false, 3); return true;"> ccc </a> <br>
</div>
<div id="foobar" style="height: 30px;">
</div>
</body>[/xml]
Nie znam się na JavaScripcie, ale powinno działać.
Ale mam pytanie... Po co jest to return true;"?
function tresc(d, a) {
if(d)
document.getElementById("foobar").innerHTML=a;
else
document.getElementById("foobar").innerHTML="";
}
</script>
</head>
<body>
<div>
<a href="#" onMouseOver="tresc(true, 'Strona Głowna'); return true;" onMouseOut="tresc(false, 1); return true;"> aaa </a> <br>
<a href="#" onMouseOver="tresc(true, 'nEWSY'); return true;" onMouseOut="tresc(false, 2); return true;"> bbb </a> <br>
<a href="#" onMouseOver="tresc(true, 'Itd.'); return true;" onMouseOut="tresc(false, 3); return true;"> ccc </a> <br>
</div>
<div id="foobar" style="height: 30px;">
</div>
</body>[/xml]
Nie znam się na JavaScripcie, ale powinno działać.
Ale mam pytanie... Po co jest to return true;"?
Re: [pomoc] onmouseover
Bo wszyscy tak robią 
A tak poważnie to jak zwrócisz false, albo nic, to blokujesz tak jakby kolejne efekty kolejki zdarzeń. Np. jeśli w onmouseover zmieniasz tekst na statusbarze, to z tego co pamiętam nie zmieni się, jeśli nie zwrócisz true.
A tak poważnie to jak zwrócisz false, albo nic, to blokujesz tak jakby kolejne efekty kolejki zdarzeń. Np. jeśli w onmouseover zmieniasz tekst na statusbarze, to z tego co pamiętam nie zmieni się, jeśli nie zwrócisz true.
Re: [pomoc] onmouseover
chodzi o to czy skrypt ma zostac wykonany jeden raz (return false) czy ma sie powtarzac (return true) 
Re: [pomoc] onmouseover
Chyba nie dokładnie, ale ja też teraz doczytałem.
return true/false; z even'u daje efekt tylko w IE i chodzi o to, czy wykonana zostanie normalna akcja. Według w3c i normalnych przeglądarek robi się po prostu event.preventDefault(), a według IE return false.
http://javascriptkit.com/dhtmltutors/domeventp2-1.shtml
Lepszego wytłumaczenia nie znalazłem nigdzie - ktoś może ma?
return true/false; z even'u daje efekt tylko w IE i chodzi o to, czy wykonana zostanie normalna akcja. Według w3c i normalnych przeglądarek robi się po prostu event.preventDefault(), a według IE return false.
http://javascriptkit.com/dhtmltutors/domeventp2-1.shtml
Lepszego wytłumaczenia nie znalazłem nigdzie - ktoś może ma?

