...

View Full Version : Add an attribute to the <BODY>



jleone
03-01-2007, 06:36 PM
I want to do an action which causes a postback. The postback checks to see if the action took place. If it did, I want to add an "onload" to the <BODY>. How do I do this?

The following code will put the attribute in the <FORM>, but it doesn't fire on the postback load.

Page.Form.Attributes.Add("onload", "OpenFile();")

There is no "Me.Attributes.Add" - that would be nice.

felgall
03-01-2007, 07:07 PM
Why put it there when it belongs in the Javascript code.

window.onload = OpenFile;

jleone
03-01-2007, 07:09 PM
Because if my action took place, I want to add this function to fire off on my BODY onload on the postback. However, I need to add the onload attribute to the BODY tag. I don't want it to always fire off, only after my "action" has taken place.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum