Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Szerokość
kapral
post
Post #1





Grupa: Zarejestrowani
Postów: 208
Pomógł: 0
Dołączył: 5.03.2005

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


mam taki kod:
  1. <div style="height: 30px; width: 1px; backgroun-color: #000000"></div>

I czy istnieje możliwość zmiany w czsie szerokości tego div'a?
Chodzi mi oto aby co sekundę zmieniał swoją szerokość o 1 px, czyli wyszedł by taki pasek postępu
Go to the top of the page
+Quote Post
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




zjadles d (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

  1. <div id="prog" style="height: 30px; width: 1px; background-color: #000000"></div>
  2.  
  3. <script language="JavaScript">
  4. var width = 1;
  5. function show()
  6. {
  7. width++;
  8. obj=document.getElementById('prog');
  9. obj.style.width=width + "px";
  10. setTimeout('show()', 1000);
  11. }
  12. show();
Go to the top of the page
+Quote Post
kapral
post
Post #3





Grupa: Zarejestrowani
Postów: 208
Pomógł: 0
Dołączył: 5.03.2005

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


Ale to nie działa - div nie zmienia szerokości w czasie (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




A w sadziels to do html? Bo ff i ie musi to byc kompletny dokument html

  1. <div id="prog" style="height: 30px; width: 1px; background-color: #000000"></div>
  2.  
  3. <script language="JavaScript">
  4. var width = 1;
  5. function show()
  6. {
  7. width++;
  8. var obj=document.getElementById('prog');
  9. obj.style.width=width + "px";
  10. setTimeout('show()', 1000);
  11.  
  12. }
  13. show();
  14. </body>
  15. </html>


jesli nadal ci nie bedzie dzialac to pokaz bledy js
Go to the top of the page
+Quote Post
kapral
post
Post #5





Grupa: Zarejestrowani
Postów: 208
Pomógł: 0
Dołączył: 5.03.2005

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


Ok już działa - wielkie dzięki
Ja skrypt wstawiałem w head myślałem że to nie robi różnicy - a jednak
Go to the top of the page
+Quote Post
nospor
post
Post #6





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




W head mogło byc, ale tylko definicja funkcji. Juz jej wywolanie (show(); ) musi byc na koncu
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: 14.09.2025 - 17:01