I want to resize an image with javascript according to URL,
I mean If the URL is:
Image is 400x250 And if the URL is The image size is 300x150 < P> How do I do this with html and javascript? Thank you very much You can get the parameter like this: mywebsite.com/something.hmtl?width=400&hight=250
mywebsite.com/something.hmtl?width=300&hight=150
< Code> parameter = Location.search.substr (1) .split ('& amp;') for dimentions = {} (in the parameter) {attr = params [i] .split ('=') if (attr [ 0] == '[0] ==' height ') {dimmed [etter [0]] = parseint (atrir [1])}} img = document. ITAlmentBitagnam ('IMG') [0] // You will find img.setAttribute ('width', dimension ['width']) img.setAttribute ('height, dimension [' height ']) before the page.
No comments:
Post a Comment