Jump to content
php.lv forumi

Elementa pattiesais izmers...


Recommended Posts

Kaa Noteikt elementa div, table utt.. (bloka) izmeru (platums/augstums) pikseljos ?

-------

document.getElementById('id').style.width

 

atgriezj elementa vertibu kaada ir noraadiita ..

teiksim, ja noraada width:100% tad taa arii tiek atgriests -->100%

un ja width vispar nav noraadiits tad neko arii netgriezj....

---

Vajadzetu dabuut tekosho izmeru PIKSELJOS ...

 

edit: zinu ka Prottotype to maak, bet soreiz taas ir garaam ....

Velams lai arii nebuutu kaads specefisks brauzera (teiksim tikai FF ) risinajums...

Edited by Grey_Wolf
Link to post
Share on other sites

bubu --> Doma nelietoju ;)

 

uz FF FireBugs neko neuzradija :(

tik atgrieza kaa Undefined vertiibu ...

---

Edit : sho problemu meklejot uzduros intresanta f-jai..

varbuut kaadam noder.....

----------

 function alertSize() {
 var myWidth = 0, myHeight = 0;
 if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
 } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
 }
 window.alert( 'Width = ' + myWidth );
 window.alert( 'Height = ' + myHeight );
}

 

1. atgriezj realo loga izmeru (cik ir redzams)

2. mazliet parveidojot var dabuut elementa izmeru ....

------------

Edited by Grey_Wolf
Link to post
Share on other sites
×
×
  • Create New...