In my ASP.NET User Control I'm adding some JavaScript to the window.onload
event:
if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName))
Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName,
"window.onload = function() {myFunction();};", true);
My problem is, if there is already something in the onload
event, than this overwrites it. How would I go about allowing two user controls to each execute JavaScript in the onload
event?
Edit: Thanks for the info on third party libraries. I'll keep them in mind.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…