Click to See Complete Forum and Search --> : Hide IFrame if resolution/page size 2 small


Vasilli
11-18-2003, 12:38 AM
Hi all

What I am trying to do is create a script that will make an iFrame or cell (doesn’t matter) invisible when the users screen is too small
i.e. I have made my site 760px wide, so people with low res. will still see the site well, and I want to use the rest of the space to the right for adds, for people that have high res setting. But when get people viewing the site that have low res. I want the ads to disappear.

Like this page.
http://shopping.ninemsn.com.au/

Is this simple or not??
JavaScript is not really my thing?!?! :)
Thanks for any help

Jono

Jona
11-18-2003, 12:44 AM
<script type="text/javascript">
onload = function(){
&nbsp;if(screen.width < 760){
&nbsp; document.getElementById("ID_of_DIV_containing_your_ad").style.display="none";
&nbsp;}
}
</script>


[J]ona

Vasilli
11-18-2003, 01:01 AM
Thanks for such a prompt response. The problem is that it dosn't work!

i have called the div "AddsCell" and have the javascript as follows, at the top of the screen in the head

<script type="text/javascript">
onload = function(){
if(screen.width < 760){
document.getElementById("AddsCell").style.display="hidden";
}
}
</script>

am i missing something??

thanks
Jono

fredmv
11-18-2003, 04:32 AM
<script type="text/javascript">
onload = function()
{
if( screen.width < 760 ) document.getElementById('bar').style.display = 'none';
}
</script>
<iframe src="foo.html" id="bar"></iframe>