I would like to make this happen in JavaScript:
function changeAttributeValue(theAttribute, numberOfPixels)
{
theAttribute = numberOfPixels + \"px\";
}
changeAttributeValue(myImage.style.left, 50);
changeAttributeValue(myImage.style.top, 80);
changeAttributeValue(myCanvas.width, 600);
The first two calls should move an image and the third should adjust the width of a canvas.
Like this however, just the value of the passed variables were passed, so nothing happens.
Does anybody know how to solve this problem?





Rating:
The post javascript – Pass attribute, not value as parameter appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/javascript-pass-attribute-not-value-as-parameter.html
No comments:
Post a Comment