Take a look at the following simple example which illustrates this.
document.onfocus = new Function("document.bgColor='#ff0000'")
Take a look at the following simple example which illustrates this.
document.onfocus = new Function("document.bgColor='#ff0000'")