A few observations I noticed at a glance:
s.position = "absolute", ==> s.position = "absolute";
I think you meant a semicolon instead of a comma, although it makes not noticeable difference.
Now, to fix your problem, you need only change
s.width = w;
to
s.width = w + 'px';
and the same wherever you want to set width and height. It is not required when you set both to 0 (as you did in s.top and s.left), but it is necessary in strict mode for any other setting.