logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Dreamweaver General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 03-15-2006, 10:13 AM   #1
malhyp
 
Join Date: Aug 2005
Posts: 115
Default 'If' and 'then' statements and screen size.

'If' and 'then' statements and screen size.

--------------------------------------------------------------------------------

Hi there, I have a screen size resolution problem.

Is it at all possible for an 'if' statement to be created that will change the pictures viewed depending on the screen size?

Example.

Code:
If screen size = 800x600 then view this.

<div align="left">[img]images/Productsa.gif[/img]</div>

If screen size = 1024x768 then view this.
<div align="left">[img]images/Productsc.gif[/img]</div>
Thanks

Please use code tags when posting code
Mally.
malhyp is offline   Reply With Quote
Old 03-15-2006, 11:58 AM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

yes

javascript has width and height methods

here is a function i wrote to position some nav layer buttons depending on screen res

//notes:
ht & wt are hidden fileds (ht = height, wt =width)
when fired the function checks the rez and populates the hidden fields with numerics like 800, 600

Code:
function screenres(){
	
	document.getElementById('ht').value = screen.Height;
	document.getElementById('wt').value = screen.Width;
	
	}
You can then use these values to decide what to do next
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 03-15-2006, 05:16 PM   #3
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

Also try Cameron's (the man in blue) script on how to change design based on resolution.
http://www.themaninblue.com/writing/...ve/2004/09/21/
I just met him at SXSW, great guy and co-author of Sitepoint's latest DOM scripting book.
domedia is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:27 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com