How do you set page level, page-SPECIFIC javascript events using a ContentPlaceHolder?

Posted by donde on Stack Overflow See other posts from Stack Overflow or by donde
Published on 2010-05-20T14:53:05Z Indexed on 2010/05/21 0:20 UTC
Read the original article Hit count: 257

Filed under:
|

I previously asked how to include Javascript in my page when I split the page into a MasterPage and ContentPlaceHolder (.NET 2.0 app) The issue was I only wanted the javascript functions on THAT page so I couldn't just put them on the masterpage.

Based on the answers, I will inlcude common fucntions through MasterPage and can put the page-specific function right on the content page. However, 1 question remains: Events. I have 2 Javascript functions that I wanted to load when the page loads ala the HTML below. How do you load javascript page events on the specific content page? Or in the case below, the OnKeyPress event?

<body onkeypress="javascript:keypressed();" onload="javascript:setDivVisibility();">

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about master-pages