webForumDet fria alternativet

Bildstorlek

1 svar · 199 visningar · startad av Jesper T

Jesper TMedlem sedan nov. 20017 144 inlägg
#1

Jag skulle vilja ha ut bildens orginalstorlek. I detta fall så skriver den ut bilden efter formateringen i "style"

write("<html><body style=\"margin:2px;\"><div style=\"float:right;\"><img id=\"imgp\" src=\""+url+"\" style=\"[b]height: auto; width: 80px;[/b]\">");
write("</div><sc"+"ript>parent.form1.x_y.value='Storlek: '+document.images['imgp'].width+'x'+document.images['imgp'].height;")
write("parent.form1.imgsrc.value='"+url+"';")
write("</sc"+"ript></body></html>");
Peter SMedlem sedan dec. 20025 483 inlägg
#2

Du får väl spara höjden respektive bredden i variabler innan write()-satserna:

...
var height = document.images[ "imgp" ].height;
var width = document.images[ "imgp" ].width;
...

:)

130 ms totalt · 3 externa anrop · v20260731065814-full.0e50b1ef
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
126 ms — hämta tråd, inlägg och bilagor (db)