SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Graying out a entire page

    Hi guys:

    I'm stumbed on this one, begining to think i'm pushing the browsers too far...

    I want to disable a page, "graying out" everithing including links, and i wanted to do it in a very simple way, few code lines.

    So i try a few variations of the following:

    (graying out)
    Code:
    	var hbody=document.body.innerHTML;
    	document.body.innerHTML='<div id="fullTransparentLayer" style="filter:alpha(opacity=60);-moz-opacity:.60;opacity:.60; Z-INDEX: 1000; POSITION: absolute; width: 100%; height: 100%; left: 0px; top: 0px;">'
    		+hbody+'</div>'
    This is working almost right, some variations of it (including using writeln() instead of innerHTML, getting the HTML from a upper level div instead of the body, and a few more) works on IE but not on FF...

    So now i'm going to "ungray" the page.

    Code:
    document.body.innerHTML=hbody;
    Ok, it's "ungrayed in"... But the *very big* annoyance is that my links and my onclicks just stop working!!!!!


    Can someone shred some (gray) light on this one?


    Thanks a lot.

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    London, UK
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the hbody object escaped the second time perhaps?
    Does this work:
    document.body.innerHTML='<div><a href="http://">sitepoint</a><img src="/foo.gif" /></div>';

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, that works ok. And in a second look, i really don't have links on my page, i mean, i have <a> without href but with onclick's. It seems is those onclicks that arenīt working.

    I now have a clue to pursue, thanks for your insight.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •