javascript equivalent of ASP preInit event
- by Pankaj Kumar
Hi guys,
searching for this has yielded no resuts..
i have a middle page that has an iframe and all the pages open in that iframe...i have to implement a chat system just like in Google and so to ensure that the chat windows did not close whwn the page would postback i am opening all pages in iframe....
this is a social networking site and user can have themes which have background images per theme
now when i visit a friends profile the backgrounf image of the middle page should change...
i have this code to find parent of iframe and change background image
$(document).ready(function(){
var theme=document.getElementById("ctl00_decideFooterH").value;
var t= parent.document.getElementsByTagName("body");
if(theme=='basicTheme'){
t[0].className="basic";
}
else if(theme=='Tranquility')
{
t[0].className="Tranquility";
}
else if(theme=='AbstractPink')
{
t[0].className="abstractPink";
}
});
and this code is the master page that all child pages that would open in iframe would access..the trouble is that there is a lag between the theme application on server side(which happens at PreInit) and the background image change which is done by this document.ready that gets executed after the iframe has loaded..
so essentially i need a javascript function that would either execute parallel to PreInit or some other logic....so guys plz help its urgent