Difference between revisions of "Talk:CSS Independent Content"

From GreaseSpot Wiki
Jump to navigationJump to search
(How about this instead?)
Line 14: Line 14:
== How about this instead? ==
== How about this instead? ==


function $(id) {return document.getElementById(id)};
  function $(id) {return document.getElementById(id)};


var iframe = document.createElement("iframe");
  var iframe = document.createElement("iframe");
iframe.setAttribute("id", "settings");
  iframe.setAttribute("id", "settings");
iframe.setAttribute("style", "display:block;z-index:1002;position:fixed;overflow:auto;left:30px;top:30px;right:30px;bottom:30px;background-color:white;padding:15px;border:1px solid black");
  iframe.setAttribute("style", "display:block;z-index:1002;position:fixed;overflow:auto;left:30px;top:30px;right:30px;bottom:30px;background-color:white;padding:15px;border:1px solid black");
iframe.addEventListener('load', showSettings2, false);
  iframe.addEventListener('load', showSettings2, false);


function showSettings2() {     
  function showSettings2() {     
     $('LIU_settings').contentDocument.body.innerHTML = '<html><body>test</body></html>';
     $('LIU_settings').contentDocument.body.innerHTML = '<html><body>test</body></html>';
}
  }

Revision as of 14:11, 5 June 2007

This might be more suitable in Code snippets?

I agree. --Henrik 05:47, 5 June 2007 (EDT)

sometimes its blank

Hi, I have a problem with this. It could be that I do something wrong. However: about 1 out of 5 times the content stays blank. I tried to change the timeout to 1000. I tested it 20 times, and it worked all the time.

Isn't there a "domIsNowCreatedAndYouCanGoAhead" event that we can listen to instead of using setTimeout?

How about this instead?

 function $(id) {return document.getElementById(id)};
 var iframe = document.createElement("iframe");
 iframe.setAttribute("id", "settings");
 iframe.setAttribute("style",  "display:block;z-index:1002;position:fixed;overflow:auto;left:30px;top:30px;right:30px;bottom:30px;background-color:white;padding:15px;border:1px solid black");
 iframe.addEventListener('load', showSettings2, false);
 function showSettings2() {    
   $('LIU_settings').contentDocument.body.innerHTML = '<html><body>test</body></html>';
 }