want to run a script on page load
ASP.NET
2
Posts
2
Posters
0
Views
1
Watching
-
hi, i want to run a script on page load. the page is included in a masterpage contentplace holder. eg.
obj=(document.all) ? document.all\['<%=pnlOptPro.ClientID %>'\] : document.getElementById('<%=pnlOptPro.ClientID %>'); obj.style.display=(obj.style.display=='none') ? 'inline' : 'none'; obj1=(document.all) ? document.all\['<%=pnlUsrwise.ClientID %>'\] : document.getElementById('<%=pnlUsrwise.ClientID %>'); obj1.style.display=(obj1.style.display=='none') ? 'inline' : 'none';
the code which is in the script has to be run when this page is loaded. but this does not happen??
-
hi, i want to run a script on page load. the page is included in a masterpage contentplace holder. eg.
obj=(document.all) ? document.all\['<%=pnlOptPro.ClientID %>'\] : document.getElementById('<%=pnlOptPro.ClientID %>'); obj.style.display=(obj.style.display=='none') ? 'inline' : 'none'; obj1=(document.all) ? document.all\['<%=pnlUsrwise.ClientID %>'\] : document.getElementById('<%=pnlUsrwise.ClientID %>'); obj1.style.display=(obj1.style.display=='none') ? 'inline' : 'none';
the code which is in the script has to be run when this page is loaded. but this does not happen??
Try writing it as a function and registering it with the body onload event. More likely than not the script is running but the page hasn't finished loading yet.
Mark's blog: developMENTALmadness.blogspot.com