It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Partner Sites
Board index Programming HTML Forum Script-archive

Screen Resolution Checker (V. Simple)

Share your completed scripts.

Screen Resolution Checker (V. Simple)

Postby JS92 on Fri Feb 29, 2008 9:19 pm

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: Select all
<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
NoCostGaming.co.uk - Please Sign Up
User avatar
JS92
 
Posts: 22
Joined: Tue Feb 26, 2008 10:27 pm

Re: Screen Resolution Checker (V. Simple)

Postby JS92 on Wed Feb 11, 2009 1:02 am

omg nearly 1000 views and no reply!!!
NoCostGaming.co.uk - Please Sign Up
User avatar
JS92
 
Posts: 22
Joined: Tue Feb 26, 2008 10:27 pm

Re: Screen Resolution Checker (V. Simple)

Postby rangana on Wed Feb 11, 2009 1:59 am

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.
~ Get me some work, I do freelancing ~
User avatar
rangana
500+ Club
 
Posts: 929
Joined: Wed Feb 27, 2008 6:14 am
Location: Cebu City Philippines

Re: Screen Resolution Checker (V. Simple)

Postby Johnathan on Wed Feb 11, 2009 2:00 am

What is there to reply to? You're not asking a question and if people are using it they're clearly not having problems.
Johnathan
1000+ Club
 
Posts: 1204
Joined: Thu May 31, 2007 4:28 pm
Location: Belfast, Northen Ireland

Re: Screen Resolution Checker (V. Simple)

Postby flabbyrabbit on Wed Feb 11, 2009 11:37 pm

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
User avatar
flabbyrabbit
500+ Club
 
Posts: 691
Joined: Thu Jan 25, 2007 2:10 pm
Location: Midlands, England

Re: Screen Resolution Checker (V. Simple)

Postby rangana on Thu Feb 12, 2009 1:50 am

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.
~ Get me some work, I do freelancing ~
User avatar
rangana
500+ Club
 
Posts: 929
Joined: Wed Feb 27, 2008 6:14 am
Location: Cebu City Philippines


Return to Script-archive

Who is online

Users browsing this forum: No registered users and 0 guests