wrote:
> <img src='s.jpg' onload="javascript:if(this.width>100)
> javascript:document.write('WIDTH=100% LEFTMARGIN=10');">
>
> However, it didn't give the result I want. Would someone please give me
> some clues?
1. Get rid of javascript pseudo-protocols. If you do a search about it
within this group, you'll get lots of reasons why not to use it.
2. You're using document.write. It's performing an action which you
are not expecting.
I prefer not to use inline javascript, but here's something that can
get you started:
javascript
:
function adjustImg(oImg)
{
if(oImg.width > 100)
{
oImg.style.width = "100%";
oImg.style.marginLeft = "10px";
}
}
html:
<img src = "path/name.ext" onload = "adjustImg(this)">