Re: Master pages with a onload command.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Take a look at the RegisterStartupScript method. Use that or declaratively
add your javascript call to the onload event with "window.onload = {name of
function, no parentheses}" Then it doesn't matter where your <body> tag is.

"Mufasa" <jb@xxxxxxxxxxx> wrote in message
news:%23eJv6um3HHA.4672@xxxxxxxxxxxxxxxxxxxxxxx
I have a master page with stuff in it. It includes the body tag and then
the asp:content tag. I want to hide some text when the page is loaded but
is made visible by a check box. All that code works fine. I have the text
in a <div> that I hide/unhide when a checkbox is clicked and it's all done
at the client level.

Problem is, to hide the text I need to call a javascript function on load.
The only place it seems to work is in the <body> command. But if I do
that, I get a warning about having a <body> command within a <div> command
(the div is part of my master page.)

Anyway around this? I would like to leave the stuff at the client side so
it responds immediately without a postback to the server.

TIA - Jeff.




.



Relevant Pages