I think you have to do this another way because the onload does escape some stuff. You need to put this into an function in an external js file and include the file. Than you can call this function in the onload setting.
And as I said. you have adopt the Javascript to your html/id structure