看到CSDN上有人提问,就简单做了个,仅在IE下测试可用,其它浏览器未测试!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="Jquery/jquery-1.4.2.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $(window).resize(function () { var width = $(this).width(); var height = $(this).height(); $("#div1").height(height - 30); $("#div1").width(width - 10); }); }); </script> </head> <body> <form id="form1" runat="server"> <div id="div1" style="filter: progid:dximagetransform.microsoft.alphaimageloader(src='Images/sms_logo.png', sizingmethod='scale');"> </div> </form> </body> </html>