I have the following script that I have created to get the image wiidth and pass it to a text field.
My first problem I am having is that the image width works but it doesn't do it all the time. It seems to be selective about it, I am doing it wrong?
Code:<form method="post" action=""> <script type="text/javascript"> function getwidth(imgId,strPath) { var img = new Image(); img.src = strPath; alert(img.width); } </script> <select name="photo1" id="photo1" class="formselect" onchange="getwidth('photo1',this.value);"> <option value="" selected="selected">Choose A Photo</option> <option value="photo1.jpg">photo1.jpg</option> <option value="photo2.jpg">photo2.jpg</option> <option value="photo3.jpg">photo3.jpg</option> <option value="photo4.jpg">photo4.jpg</option> <option value="photo5.jpg">photo5.jpg</option> <option value="photo6.jpg">photo6.jpg</option> <option value="photo7.jpg">photo7.jpg</option> <option value="photo8.jpg">photo8.jpg</option> <option value="photo9.jpg">photo9.jpg</option> <option value="photo10.jpg">photo10.jpg</option> </select> <input size="4" name="photo1_size" id="photo1_size" value="" readonly="yes"> </form>



Reply With Quote

Bookmarks