I want to fire script on page only when user triggers proper event. In my case user by button click adds new record to database. I'am able to obtain dynamically created control reference with new record in code behind , I just don't know how from code behind pass it this single time to JavaScript that will fire after page loads.
My script will look like this :
function(id) {
document.getElementByID(id).focus()
}
I'am using .net framework 1.1
Do you have idea how I can accomplish this task ?
You need to consider
window
is the EventTarget you're looking for because it's the top-most DOM related Object you can reference. So, using EventTarget.addEventListener
window.addEventListener('load', function () {
// code to execute when this handler is invoked
});
Edit: I'm not sure your environment will have window
, if it doesn't then you'll probably want the highest Node you can access in your DOM structure.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.