Показать сообщение отдельно
Старый 27.11.2006, 21:05     # 3
max2k1
Guest
 
Сообщения: n/a

Живой но банальный пример:
Код:
<img id="TheImage" src="http://img166.***************img166/7742/pagegeneralxi0.th.jpg" border="0"/>
<script language="JavaScript">
<!--
    function xbGetWindowWidth(windowRef)
    {
        var width = 0;
        if (!windowRef) windowRef = window;
        if (typeof(windowRef.innerWidth) == 'number') width = windowRef.innerWidth;
        else if (windowRef.document.body && typeof(windowRef.document.body.clientWidth) == 'number') width = windowRef.document.body.clientWidth;
        return width;
    }

    function xbGetElementById(e)
    {
        if(typeof(e)!='string') return e;
        if(document.getElementById) e=document.getElementById(e);
        else if(document.all) e=document.all[e];
        else e=null;
        return e;
    }

    function on_window_resize(e)
    {
        var v_window_width=xbGetWindowWidth();
        var o = xbGetElementById('TheImage');
        if (o) o.width=v_window_width;

    }

    window.onresize = on_window_resize;
    on_window_resize(null);
// -->
</script>