i don't know if this problem should be here but here it is:
i have a asp.net site and with a masterpage and many content pages. i
have a problem using Google Maps JavaScript API. in content page i use
<body onload="load()" onunload="GUnload()"> and it use to work. The
problem is that i had to put javascript functions in masterpage and
used <body id="mBody" onload="javascript:preloader();". Now the google
maps API doesn't work because of the 2 onload events(in masterpage and
contentpage). How to solve this? I looked up for solutions:
Set your masterpage body tag to:
<body id="mBody" runat="server">
Then add this on any page that uses the master and wants to access the
body tag:
public void Page_Load(Object sender, EventArgs e)
{
//Inject onload and unload
HtmlGenericControl body =
(HtmlGenericControl)Master.FindControl("mBody");
body.Attributes.Add("onload", "Function1()");
body.Attributes.Add("onunload", "Function2()");
}
but this just work if there is any onload event already in masterpage.
also tried to put onload event of google map in a table like this <table onload="load()"....but doesnt work.
can someone get a solution please?
thanks in advance