Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Powiekszyc warstwe
Polik
post
Post #1





Grupa: Zarejestrowani
Postów: 87
Pomógł: 0
Dołączył: 11.12.2003

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


Witam!

Mam pewien problem. Chcialbym za pomoca funkcji w js powiekszac lub pomiejszac warstwe lecz nie umiem sie dostac do jej szerokosci i wysokosci. Probowalem w ten sposob:

document.getElementById("div_image").width = width;

i nic. Probowalem tez tak:

document.getElementById("div_image").style.width = width;

i tez nic. Szukalem w necie ale niestety nie znalazlem.

Pomozcie koledzy.
Pozdrawiam!

Ten post edytował Polik 13.10.2007, 07:56:14
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
Cysiaczek
post
Post #2





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




http://developer.mozilla.org/en/docs/DOM:element#Properties
Tam znajdziesz to, czego szukasz.
Na marginesie - element.style.width możesz użyć, gdy zdefiniowałeś atrybut style przy elemencie i zawarłę¶śc tam width.

Pozdrawiam.


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
Polik
post
Post #3





Grupa: Zarejestrowani
Postów: 87
Pomógł: 0
Dołączył: 11.12.2003

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


niestety nie znalazlem tam tego czego szukalem sad.gif udalo mi sie tylko znalezc offsetWidth ale to jest parametr jedynie do odczytu
na w3schools wyczytalem cos takiego: document.getElementById("b1").style.width="300px"; jednak tez mi nie chce dzialac.

moze prztblize troche moja sytuacje. Oto kod warstwy ktora chce powiekszyc

#div_image {
position: absolute;
display: none;
left: 20px;
top: 20px;
width: 10px;
height: 10px;
clip: rect(0px,10px,10px,0px);
background-color: #FFFFFF;
text-align: left;
z-index: 1;
}

i mam taka funkcjie:

function show_image(url)
{
document.getElementById("gallery_image").src = url;
document.getElementById("div_fade").style.display = "block";
document.getElementById("div_image").style.width = "300px";
document.getElementById("div_image").style.display = "block";
}

niestety poszerzanie nie dziala

pozdr!
Go to the top of the page
+Quote Post
prgTW
post
Post #4





Grupa: Zarejestrowani
Postów: 62
Pomógł: 3
Dołączył: 10.09.2004
Skąd: Warszawa

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


Przez DOM:
document.getElementById('blah').clientWidth
document.getElementById('blah').clientHeight

Przez inline-style (atrybut style przy tagu):
document.getElementById('blah').style.width
document.getElementById('blah').style.height

Ten post edytował prgTW 13.10.2007, 13:59:25


--------------------
Pozdrawiam
Tomasz Wójcik
..:: prgTW ::..
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 Aktualny czas: 19.08.2025 - 13:37