views:

124

answers:

1

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

A: 

Put simply, there isn't one. jQuery's $(document).ready is about as close as you can get. The javascript can't run until the browser has loaded enough of the document to run it.

If possible, I'd set the class on the server side.

Olly Hodgson
though so... i am currently trying to use ClientScript.RegisterOnSubmitStatement to try to change the background as soon as the form is posted....i will tell if i have any success
Pankaj Kumar