Add body onload function dynamicly
ASP.NET
2
Posts
2
Posters
0
Views
1
Watching
-
Hello Is it possible to add a javascript function dynamicly into the "onload"-Element of the body tag, in a ASP.NET- website? And How? ;) Best regards Succo
-
Hello Is it possible to add a javascript function dynamicly into the "onload"-Element of the body tag, in a ASP.NET- website? And How? ;) Best regards Succo
Yes, it is possible. First, in the aspx page add "id" and "runat" atttributes to the "body" element:
<body id="main" runat="server">
. Second, add code that adds the "onload" attribute/value to the "body" element:main.Attributes.Add("onLoad", "javacript code");
"We make a living by what we get, we make a life by what we give." --Winston Churchill