【发布时间】:2011-05-08 09:55:38
【问题描述】:
这是我从网络获得的用于获取图像宽度的代码。 效果很好。
<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//
但我需要在 //Second Alert// 位置访问 image_width 变量 上面的代码。我没有在那里得到宽度值。有什么要做的吗 在那里获得价值?
请帮帮我………… 提前致谢
【问题讨论】:
-
你需要它做什么?就像 RoToRa 说的那样,这是不可能的,所以也许我们可以帮助您找到解决您最初需求的方法。
标签: javascript image callback size width