Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Wstawianie getElementById
tomek0077
post
Post #1





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 6.01.2004

Ostrzeżenie: (0%)
-----


Mam skrypt który nie działa pod Mozilla - wiem że tu chodzi o getElementById zamiast all i layers. Jednak po zamianie nadal nie działą... Jak to powinno wyglądać prawidłowo ?

Kod
<script LANGUAGE="JavaScript">
function zmien() {
if (!document.layers && !document.all) return;
tytul = document.linki.q1.value;
line1 = document.linki.q2.value;
line2 = document.linki.q3.value;
link1 = document.linki.q4.value;
if (document.layers) {
document.layers.tytul2.document.write(tytul);
document.layers.tytul2.document.close();
document.layers.line11.document.write(line1);
document.layers.line11.document.close();
document.layers.line12.document.write(line2);
document.layers.line12.document.close();
document.layers.link12.document.write(link1);
document.layers.link12.document.close();
}
else
if (document.all)
tytul2.innerHTML = tytul;
line11.innerHTML = line1;
line12.innerHTML = line2;
link12.innerHTML = link1;
}
</script>
Go to the top of the page
+Quote Post
akubiczek
post
Post #2





Grupa: Zarejestrowani
Postów: 189
Pomógł: 0
Dołączył: 4.07.2004
Skąd: z neostrady

Ostrzeżenie: (0%)
-----


No to pokaż jak zamieniłeś.. zresztą wywal wszystko co masz i użytj tylko document.getElementById() - obecnie zadziała to we wszystkich normalnych przeglądarkach
Go to the top of the page
+Quote Post
tomek0077
post
Post #3





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 6.01.2004

Ostrzeżenie: (0%)
-----


Problem jest już rozwiązany (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)


Kod
function zmien(e) {
try {with(document){
getElementById('tytul2').innerHTML=linki.q1.value;
getElementById('line11').innerHTML=linki.q2.value;
getElementById('line12').innerHTML=linki.q3.value;
getElementById('link12').innerHTML=linki.q4.value;
}}catch(e){}
}
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.12.2025 - 12:54