sastro Posted June 1, 2012 Share Posted June 1, 2012 Here is my code <script type="text/javascript"> function resize(id,va) { document.getElementById(id).width = va ; } </script> <img src="https://www.google.com/logos/classicplus.png" id="img" height="100%"> <script type="text/javascript">resize('img','50%');</script> Its not working to resize the image with % but worked without %. I need to resize image width with persentage. Please help Link to comment https://forums.phpfreaks.com/topic/263489-javascript-resize-image-width/ Share on other sites More sharing options...
requinix Posted June 1, 2012 Share Posted June 1, 2012 Percentages only work in CSS rules. document.getElementById(id).style.width = va; Link to comment https://forums.phpfreaks.com/topic/263489-javascript-resize-image-width/#findComment-1350367 Share on other sites More sharing options...
sastro Posted June 2, 2012 Author Share Posted June 2, 2012 Ok, thx. It works with css. Link to comment https://forums.phpfreaks.com/topic/263489-javascript-resize-image-width/#findComment-1350513 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.