window.onload = function ()
{
var menu = document.getElementById('menu');
var items = menu.childNodes[1].children;
var orWidth = menu.offsetWidth;
var sun=0;
for (var i=0; i<items.length; i++)
{
var sum = items[i].offsetWidth;
sun+=sum;
if (sun > orWidth)
{
var newMenu = document.createElement('DIV');
items.insertBefore(newMenu, items[i])
}
}
}
|