這是我從網絡獲取圖像寬度的代碼。 它很好用。使用JavaScript獲取圖像寬度有問題?
<script type="text/javascript">
function CreateDelegate(contextObject, delegateMethod)
{
return function()
{
return delegateMethod.apply(contextObject, arguments);
}
}
function imgTesting_onload()
{
image_width=this.width;
alert(image_width);//First Alert
}
</script>
var imgTesting = new Image();
imgTesting.onload = CreateDelegate(imgTesting, imgTesting_onload);
imgTesting.src = "${str_applicationPath}/common/images/reports/"+report+".png"
//Second Alert//
但我需要的是在第二次// //警報地方訪問IMAGE_WIDTH變量 上述code.I我沒有得到寬度值there.Is什麼工作要做,以 GET值有?
請幫我......... 由於提前
你需要什麼?就像RoToRa說的那樣,這是不可能的,所以也許我們可以幫助你找到解決你最初需求的方法。 – 2010-11-11 15:20:34