document width returns null?

document width returns null?

The following code returns me a null value on internet explorer but works fine on firefox and opera.

var iW = $(document).width();
alert(iW);

any help would be appreciated, thanks