By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,817 Members | 2,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,817 IT Pros & Developers. It's quick & easy.

detecting screen res in netscrape

P: n/a
got the usual script:

<script language="JavaScript" type="text/JavaScript">
var s_height = screen.Height
var s_width = screen.Width
var s_screen= screen.colorDepth

if ( s_height == "480" && s_width == "640" )

{
window.location = "bigframe/index.htm"
}

else if

( s_height == "800" && s_width == "600" )

{
<do this>
}
but doesn't seem to want to work in netscape is there antway of doing it
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

"Andy" <andy@jarrow_online.com> schreef in bericht
news:bq**********@news8.svr.pol.co.uk...
got the usual script:

<script language="JavaScript" type="text/JavaScript">
The type should be lowercased: text/javascript
var s_height = screen.Height
var s_width = screen.Width


These properties should be called lowercased also:

var s_height = screen.height
var s_width = screen.width
JW

Jul 20 '05 #2

P: n/a
Janwillem Borleffs wrote:
<script language="JavaScript" type="text/JavaScript">

The type should be lowercased: text/javascript


Why? The type is an HTML attribute, and hence is case insensitive.

Jul 20 '05 #3

P: n/a
Keith Bowes wrote on 07 Dec 2003:
Janwillem Borleffs wrote:
<script language="JavaScript" type="text/JavaScript">


The type should be lowercased: text/javascript


Why? The type is an HTML attribute, and hence is case insensitive.


That /particular/ attribute is case-insensitive. Most, but not all,
are (id and class being important ones).

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk")
Jul 20 '05 #4

P: n/a
On Sun, 7 Dec 2003 10:17:34 -0000, "Andy" <andy@jarrow_online.com>
wrote:
got the usual script:

<script language="JavaScript" type="text/JavaScript">
var s_height = screen.Height
var s_width = screen.Width
var s_screen= screen.colorDepth

if ( s_height == "480" && s_width == "640" )

{
window.location = "bigframe/index.htm"
}

else if

....

If you're going to do this sort of thing you ought to use window size,
not screen size. The window is after all what you have to display in.
For a working example, you could have a look at a bit of playing around
I've done: http://www.xs4all.nl/~sbpoley/webmatters/resize.html
though there may well be better versions around.

In any case, make sure that a reader without Javascript gets some
reasonable version of the page.

--
Stephen Poley
Jul 20 '05 #5

P: n/a
Andy wrote:
got the usual script:
You mean you copy-pasted the usual crap. Yes, indeed, you did.
<script language="JavaScript" type="text/JavaScript">
Skip the language attribute, it is deprecated and not required as
long as you use the `type' attribute.
var s_height = screen.Height
var s_width = screen.Width
It's `screen.height' and `screen.width' (JavaScript is case-sensitive),
and it is still scriptkiddie crap since

Display resolution != desktop size != size of browser window != size
of browser viewport. [psf 3.7]
[...]
Drop the whole thing.
[...] is there antway of doing it


Yes, *not* doing it, because you do not need it with working markup anyway.
PointedEars
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.