jQuery resize image using window wxh

by nickadeemus2002

HTML

<div id="start">
    <a href="#" id="go">click to resize the image</a>
</div>

<img id="texas" src="http://www.psychpa.com/images/UofTexas.gif"
width="260" height="185"/>

JavaScript

$('#go').click(function(){
    //auto adjust the image size according 
    //to the windows size~ w x h
    var viewWidth = $(window).width();
    var viewHeight = $(window).height();
   alert('window width= '+ viewWidth + ', window height=' + viewHeight); 
   //change img w x h using window size
    $('#texas').attr({
        width: viewWidth,
        height: viewHeight
    });
});