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 Quote Link to comment 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; Quote Link to comment Share on other sites More sharing options...
sastro Posted June 2, 2012 Author Share Posted June 2, 2012 Ok, thx. It works with css. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.