DEVPPL
http://www.devppl.com/forum/

Screen Resolution Checker (V. Simple)
http://www.devppl.com/forum/viewtopic.php?f=52&t=9511
Page 1 of 1

Author:  JS92 [ Fri Feb 29, 2008 9:19 pm ]
Post subject:  Screen Resolution Checker (V. Simple)

http://www.js92.110mb.com/
At the bottom that website, there is some text: 'Check Your Screen Resolution Here!' Click that and a pop up message will tell you your exact screen size!
This is the code for it:
Code:
<a href="javascript:alert('Your resolution is '+screen.width+'x'+screen.height);">Text Goes Here!</a>

A pretty simple code and probably not even majorly required but atleast you can have this cool feature on your website!
Thanks for viewing this thread :D

Author:  JS92 [ Wed Feb 11, 2009 1:02 am ]
Post subject:  Re: Screen Resolution Checker (V. Simple)

omg nearly 1000 views and no reply!!!

Author:  rangana [ Wed Feb 11, 2009 1:59 am ]
Post subject:  Re: Screen Resolution Checker (V. Simple)

Were you expecting for a response?

Anyway, let me poke myself in, and give you some feedback.

1. javascript pseudo-url is deprecated and shouldn't be advocated. Also, it will make your page invalid.

2. How would that link go when the user has JS disabled? They will see a dead link. I suggest you write that part of the markup with JS too so that when users has JS disabled, they wouldn't see that part of your page.

Author:  Johnathan [ Wed Feb 11, 2009 2:00 am ]
Post subject:  Re: Screen Resolution Checker (V. Simple)

What is there to reply to? You're not asking a question and if people are using it they're clearly not having problems.

Author:  flabbyrabbit [ Wed Feb 11, 2009 11:37 pm ]
Post subject:  Re: Screen Resolution Checker (V. Simple)

rangana wrote:
1. javascript pseudo-url is deprecated and shouldn't be advocated. Also, it will make your page invalid
What is the "correct" way of doing it? onClick?

Flabby Rabbit

Author:  rangana [ Thu Feb 12, 2009 1:50 am ]
Post subject:  Re: Screen Resolution Checker (V. Simple)

Yes Flabby.

The main purpose of using javascript pseudo-url is just to cancel the tags (<a>) native behavior - which is redirection.

To cancel the tags nature behavior, we can add return false at the end of the code, or use DOM's preventDefault().

Hope that makes sense.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/