updated sample for window.onload update
fix for the sample