Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Resolution detection in HTML



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> HTML Forum
View previous topic :: View next topic  
Author Message
rhaul82



Joined: 22 Nov 2005
Posts: 3

PostPosted: Tue Nov 22, 2005 4:23 am    Post subject: Resolution detection in HTML Reply with quote

I'm new to HTML and have a quick question-

I am working on an html page and would like the banner to change corresponding to the resolution. for example, if the resolution of the viewer is 1024x768, i want to show the 1024 banner. if the resolution is 800x600, i want to show the 800 banner.

So, my questions being-

1. How can i do a resolution detection in html?
2. how can i include if conditions- ex- if(res == 800) show banner 800 else show banner 1024.

I looked online and all the info i found was relating to java scripts. but the page i'm working on is an HTML page.
I option i think might work is using an java applet to detect the resolution. but i don't know how to modfiy/edit the applet and use its output in a conditional.

Any ideas?????

Thanks in advance.
Back to top
View user's profile Send private message
mwa103
100+ Club


Joined: 07 Mar 2005
Posts: 206

PostPosted: Tue Nov 22, 2005 4:34 am    Post subject: Re: Resolution detection in HTML Reply with quote

this can be done fairly easily using php. Here is an example using cookies:
http://www.phpbuddy.com/article.php?id=8
I know there are many ways of doing this, probably some better than this. I'd read up on php.

Good Luck
-Mike
Back to top
View user's profile Send private message MSN Messenger
rhaul82



Joined: 22 Nov 2005
Posts: 3

PostPosted: Tue Nov 22, 2005 4:44 am    Post subject: screen res Reply with quote

How the hell do i integrate php code in my html file?? I have a .html page. I don't have a server or anyting. this is just a plain ol html website.
Back to top
View user's profile Send private message
mwa103
100+ Club


Joined: 07 Mar 2005
Posts: 206

PostPosted: Tue Nov 22, 2005 4:51 am    Post subject: Re: Resolution detection in HTML Reply with quote

I guess php won't work then if it has to be a html file. you need php installed in order to use it. Using just html you will probably have to do something with javascript or something. There is an option in html to use % as width instead of a fixed width, but that assumes you use the same banner and not three different sizes. Sorry I'm not too much help on this one.

Good luck
-Mike
Back to top
View user's profile Send private message MSN Messenger
webmaster
Site Admin


Joined: 17 Aug 2004
Posts: 3620
Location: Sweden

PostPosted: Tue Nov 22, 2005 10:20 am    Post subject: Re: Resolution detection in HTML Reply with quote

First of all I would like to welcome you to DEVPPL. So, welcome to DEVPPL Smile

Here's a solutions that will work:
Code:
<script language="JavaScript1.2">

var screen_height = screen.height;

if (screen_height >= 768) {

   document.write('<img src="test.jpg" width="1000" height="200" />');

} else {

   document.write('<img src="test.jpg" width="800" height="150" />');

}

</script>


Last edited by webmaster on Tue Nov 22, 2005 6:48 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
rhaul82



Joined: 22 Nov 2005
Posts: 3

PostPosted: Tue Nov 22, 2005 6:39 pm    Post subject: thanks Reply with quote

Thanks bunches. worked likea charm.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> HTML Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap