Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [js] usunac px z height
macza
post
Post #1





Grupa: Zarejestrowani
Postów: 236
Pomógł: 4
Dołączył: 1.05.2006
Skąd: Lublin

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


mam takie cus (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif) :
  1. <script language="javascript">
  2. function o(){
  3. document.getElementById( 'pole' ).style.height='100';
  4. }
  5.  
  6. function plus(){
  7. wys=document.getElementById( 'pole' ).style.height;
  8. alert( wys );
  9. }
  10.  
  11.  
  12. </head>
  13. <body onLoad="o()">

funkcja o daje wysokosc 100
i jak pobieram funkcja plus to w alercie wyskakujemi "100px", a ja chce dodac do tego jakas wartosc i jak daje alert( wys+20 ); to wychodzi: "100px20"
please o help
prosze o pomoc (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
phpion
post
Post #2





Grupa: Moderatorzy
Postów: 6 072
Pomógł: 861
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




No wlasnie dostales porade odnosnie JS... hehe parseInt() jest szczegolnie pehapowe (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
A nie mozesz usunac px poprzez zastapienie go pustym ciagiem?
  1. <script language="javascript">
  2. function o(){
  3. document.getElementById( 'pole' ).style.height='100';
  4. }
  5.  
  6. function plus(){
  7. wys=document.getElementById( 'pole' ).style.height;
  8. wys = wys.replace('px', '');
  9. alert( wys );
  10. }
  11. </head>
  12. <body onLoad="o()">


Ten post edytował phpion.com 22.08.2006, 20:56:00
Go to the top of the page
+Quote Post

Posty w temacie


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: 11.10.2025 - 23:48