i have some pictures in a page. there are have difference sizes. some
of them are too widen for be arrange in a line. so
i been tried to adject their sizes to more suitable.
i add a event to that image likes:
<img id="img" onLoad="adjustS ize(this)" src="123.jpg">
and write a function in javascript:
function adjustSize(obj) {
if (obj.width>250) {
sizeRate=250/obj.width;
obj.width=obj.w idth*sizeRate;
if (obj.hight>268)
obj.hight=268;
}
}
but exactly,i can get the image's width and height. cuz the loading
hasn't finished while the function of adjustSize works.
can somebody tell me how to deal this.
Tks advanced.
of them are too widen for be arrange in a line. so
i been tried to adject their sizes to more suitable.
i add a event to that image likes:
<img id="img" onLoad="adjustS ize(this)" src="123.jpg">
and write a function in javascript:
function adjustSize(obj) {
if (obj.width>250) {
sizeRate=250/obj.width;
obj.width=obj.w idth*sizeRate;
if (obj.hight>268)
obj.hight=268;
}
}
but exactly,i can get the image's width and height. cuz the loading
hasn't finished while the function of adjustSize works.
can somebody tell me how to deal this.
Tks advanced.
Comment