Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [javascript] Alternatywa document.write
Zwariowany
post 6.02.2010, 20:05:41
Post #1





Grupa: Zarejestrowani
Postów: 201
Pomógł: 0
Dołączył: 6.01.2009

Ostrzeżenie: (20%)
X----


Witam. Jak mam w JS document.write(coś tam coś tam) to pojawia mi się to w nowym oknie nie białym tle, a jak zrobić, by to tylko "dopisało" się do bieżącej zawartości strony?


--------------------
Go to the top of the page
+Quote Post
skowron-line
post 6.02.2010, 20:07:29
Post #2





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


Poczytaj o innerHTML.


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
Zwariowany
post 6.02.2010, 20:22:10
Post #3





Grupa: Zarejestrowani
Postów: 201
Pomógł: 0
Dołączył: 6.01.2009

Ostrzeżenie: (20%)
X----


Czyli nie ma alternatywy dla document.write?


--------------------
Go to the top of the page
+Quote Post
wookieb
post 6.02.2010, 20:30:41
Post #4





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




Jest alternatywa do twojej głupoty pt PRZECZYTAJ POST KOLEGI JESZCZE RAZ.


--------------------
Go to the top of the page
+Quote Post
daniel1302
post 6.02.2010, 20:54:24
Post #5





Grupa: Zarejestrowani
Postów: 602
Pomógł: 30
Dołączył: 1.08.2007
Skąd: Nowy Sącz

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


w document.getElementByID('#ID').innerHTML += 'jakis tekst';
Go to the top of the page
+Quote Post
Zwariowany
post 6.02.2010, 23:10:22
Post #6





Grupa: Zarejestrowani
Postów: 201
Pomógł: 0
Dołączył: 6.01.2009

Ostrzeżenie: (20%)
X----


ale jak mam taką funkcję:

  1.  
  2. function show(url,width,height)
  3. {
  4. document.write('<div id="pu" style="display: block; width: 200px;">');
  5.  
  6. document.write('<img border="0" src="'+url+'" width="'+width+'" height="'+height+'" alt="" />'); 
  7. document.write('</div>');
  8. }
  9.  


To raczej innerhtml nie bedzie takie łatwe







--------------------
Go to the top of the page
+Quote Post
wookieb
post 6.02.2010, 23:19:18
Post #7





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




Wszystko zależy gdzie chcesz to dokładnie umieścic.

  1. function show(url,width,height)
  2. {
  3. var str = '<div id="pu" style="display: block; width: 200px;">';
  4. str +='<img border="0" src="'+url+'" width="'+width+'" height="'+height+'" alt="" />';
  5. str += '</div>';
  6.  
  7. document.getElementById('id_elementu_do_ktorego_chcesz_wstawic_ten_kod').innerHTML += str;
  8. // jezeli element nie ma id, no to musisz dostać uchwyt tego elementu.
  9. //U ciebie domyślam się ze chodzi o body
  10. document.body.innerHTML += str;
  11. }
  12.  
  13.  


--------------------
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 24.04.2025 - 05:51